This Demo uses Node as a proxy server to query Swapi data.
The requested data is stored in a Redis db for 60 seconds.
It demonstrates the use of middleware to check for (hardcoded) api keys, verifies they aren't in the (hardcoded) blacklist, and then checks the Redis cache for data before making the request to Swapi.
To use:
-
Clone this repository
-
Change into the newly created repo
cd redis-cache
-
Install the dependencies from Package.json
npm install
-
In a fresh command line, spin up a Redis server if it is not running as a network service
redis-server
-
Run the index.js via node, or with the dev script
npm run dev Or node index.js
That's it. Enjoy.