This is a CRUD API that stores and retrieves data from a MongoDB Atlas database. Powered by FastAPI and Beanie.
To use this App you need to have some few prerequisites.
-
Python3.10+
-
pip
-
Virtual environment (virtualenv)
-
Code/text editor
-
Terminal
-
Installing FastAPI and other Modules
python3 -m venv virtualActivate Virtual Environment
source virtual/bin/activate
- RUN:
pip install -r requirements.txtexport PYTHONPATH=$PWD - All required applications should be installed now.
- Set up MongoDB Atlas.
-
Go to MongoDB Atlas
-
Create an account
-
Create a project
-
Create a database
-
Create a collection
-
Get the database URL
mongodb+srv://<user>:<password>@<database>:<port>/<collection>?retryWrites=true&w=majority&appName=<yourAppName>"
-
Create a .env file and add MongoDB URL (
MONGO_URL)touch .envecho "MONGO_URL=mongodb+srv://<user>:<password>@<database>:<port>/<collection>?retryWrites=true&w=majority&appName=<yourAppName>" >> .env -
Run
python app/main.py