Movie title suggestions based on predefined user preferences
A runnable Postman collection can be accessed here here
To run queries against the deployed version select AWS
from the dropdown at the top of the collection
Install Serverless CLI
For more info on serverless see docs
npm install serverless -g
Install project dependencies
npm install
Install required version of node:
nvm use
Start app in offline mode
sls offline
Set up AWS credentials in preferred way. For options see docs
sls deploy
I/O of reading then the processing taken to parse and CSV files is quite intensive so decided to do this as an offline "build" step. The intention of this is to be run then the outputted .json file be committed to the repo so it can be used in the code.
This had the added advantage of being able to combine and transform the data from the two CSV files into a data structure that was easier to use in the code.
To regenerate the data run:
npm run build
Serverless framework provides an easy way to deploy to cloud infrastructure. Serverless only charges per invocation so it is a cost effective service, it also has builtin auto-scaling.
Considerations
Serverless does have it's issues one is "cold starts" where the first time a Lambda runs it takes longer than subsequent invocations. There is strategies to mitigate this including pre-warming or keeping Lambda continually warm.
Was decided not to use a database to store the data to reduce the complexity of the solution. Doing the filtering in JS is not as efficient as some database solutions would offer with their query interfaces but adding a database would have significantly increased the complexity of the solution which isn't really needed