Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FASTAPI-MongoDB-CRUD App

The application uses fastAPI and MongoDB as backend servers to implement a simple REST API.

I have used asynchronous functions in most places.

FastAPI provides amazing support for asynchronous programming.

For Database Asynchronous operations, I have used Motor python package for MongoDB.

The API provides a simple API for a student database. The API is capable of performing

  1. Retrieve all students (GET)
  2. Retrieve single student using student-id (GET)
  3. Add a student (POST)
  4. Update a student info (PUT)
  5. Delete a student from Database

Install

MongoDB local server is required to run the project. You can download the same from here. MongoDB Community Server.

Clone the repositiory and move to the repo-folder.

Install the required version appropriate for your os and get follow the instructions provided in the docs.

Note - Use Virtual Environment for Python installs.

pip install -r requirements.txt

Run

To run the application follow these instruction. if you are inside the root folder, then move into the app folder. then execute the following command.

python main.py

This will start the server in localhost:8000

To access the api endpoints, we have used the FastAPI built-in interface. go to this url for that purpose. localhost:8000/docs

test the API endpoints as much as you like!

Screenshots

  1. API Endpoints Page

  2. Get all students in database

  3. Get one student in database with ID

  4. Add a student

  5. Update a student's information

  6. delete a student object

Author

Karan Mittal

Thanks for checking the repo out. Please share your thoughts or if you had any problems running the code.

About

The project is a simple RESTful API implemented with Fast and MongoDB.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages