This project is a Flask application that allows users to perform CRUD (Create, Read, Update, Delete) operations on a MongoDB database for a User resource using a REST API. The REST API endpoints can be accessed via HTTP requests and can be tested using Postman.
To run this application, you will need:
- Python 3.6 or higher
- Flask
- pymongo
- Flask-PyMongo
- Postman (for testing)
- Clone the repository:
git clone https://github.com/djharshit/user-data-api - Navigate to the project directory:
cd user-data-api - Create a virtual environment:
python3 -m venv env - Activate the virtual environment:
source env/bin/activate - Install the required packages:
pip install -r requirements.txt - Change the MongoDB connection string in
app.pyto your own connection string - Start the application:
python app.py
Once the application is running, you can access the REST API endpoints using Postman or any other HTTP client.
The available endpoints are:
- GET
/users: Returns a list of all users - GET
/users/<user_id>: Returns a specific user - POST
/users: Creates a new user - PUT
/users/<user_id>: Updates a specific user - DELETE
/users/<user_id>: Deletes a specific user