This project sets up a MongoDB database using Docker Compose, retrieves data from an external API, and exposes this data through a FastAPI application.
-
Start MongoDB with Docker Compose:
docker-compose up -d
-
Install Python dependencies:
pip install -r requirements.txt
-
Load data into MongoDB:
python data/load_data.py
-
Run the FastAPI application:
uvicorn app.main:app --reload
/user_posts_count: Get the total number of posts from each user./post_comments/{post_id}: Get comments for a specific post./users: Add a new user./users/{user_id}: Modify an existing user./users/{user_id}: Delete a user.
Run the tests using pytest:
pytest tests/