When my application receives a request through the API endpoint, it first checks if the data is already cached in Redis. If so, it will return the information it has in the cache. The information from Reddit is only cached for a minute in order to make the application respond to requests more quickly and to not repeatedly make the same calls to Reddit to avoid rate limiting. If the information is not already cached, then my application makes a call to Reddit and then sanitizes the input it receives.
- Install docker + docker compose
- Clone this repository
- Run
docker-compose up
- You should now be able to query the API locally
- You can optionally set up an NGINX reverse proxy to forward the requests to the correct port
http://127.0.0.1/api/v1/top_articles/<subreddit>
- Clone this repository
- Set up a python3 virtual environment
pip install -r requirements.txt
- Set up development environment
- Run
nosetests