Skip to content

Latest commit

 

History

History
40 lines (39 loc) · 1.45 KB

README.md

File metadata and controls

40 lines (39 loc) · 1.45 KB

MongoDBFastAPI

This repository explains how to create a REST API using Python and host it locally using Docker. The goal of this task is to allow the user to interact with a database of products using APIs which are available on localhost via Docker.
At first, E-commerce products and its information data have been hosted on a MongoDB server. Connecting to the MongoDB server and operating basic crud operation is explained in the "MongoAPI.py" file.
REST API has been created with the help of FastAPI, that allows the user to do basic CRUD operations on the data. This process is explained in "init.py" file.
After that Dockerization of API is performed by the following command below.

docker pull mongo
docker create -it --name MongoTest -p 5000:27017 mongo
docker start MongoTest
docker compose build myreader
docker compose run -p 5001:5001 myreader

CRUD operations

Lets operate some basic CRUD operations over the REST API.
base

Read

read

Write

write write_mongo

Update

update update_mongo

Delete

delete delete_mongo