Description
Let’s extend your Redis skills.
Requirements
0. Create a new branch, PS5. For this assignment, you’re extending what you did
in PS4, so it makes sense to branch from there. Be sure that your .gitignore file
has an entry to exclude /node_modules and your config directory from being
pushed to github.
1. Refactor your Node app from PS4 to incorporate a simple redis cache on your
POST route. When the route in your app is called, first check your cache to
see if you have a valid response. If not, call the third-party API and then cache
the response before returning it to the client, otherwise return the cached
value. Use a 15-second timeout on the cache entry.
2. Refactor your response on this route to send a JSON object back to the client
instead of rendering a template. The response should include a field that
indicates whether the data came from cache or not.
3. Submit just the route file (you can leave it’s name as PS4.js if you like) on
Gradescope to complete the assignment.