Skip to content

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. REST API has been created with the help of flask, that allows the user to do basic CRUD operations on the data.

Notifications You must be signed in to change notification settings

victor369basu/MongoDBFlask

Repository files navigation

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

About

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. REST API has been created with the help of flask, that allows the user to do basic CRUD operations on the data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published