Skip to content

MovingEarth/beanie-fastapi-demo

 
 

Repository files navigation

Beanie FastAPI Demo

This is an example project demonstrating the use of Beanie ODM in a FastAPI application

Setup

This demo is based on python3 and uses Poetry to manage dependencies. Make sure you have installed poetry using the installation instructions before you begin.

As beanie is an ODM for MongoDB it needs a MongoDB database to run. If you already have a Mongo database running, change the settings in beanie_fastapi_demo/main.py accordingly. In other cases it is recommended to run MongoDB using docker and docker-compose.

Install the requirements

Installing the requirements using poetry is easy, just run the command below

poetry install

Run MongoDB

To run MongoDB using docker-compose, run

docker-compose -f docker-compose-mongodb.yml up -d

Start the app

To activate the environment managed by poetry and run the application, run

poetry run beanie-fastapi-demo

The demo application can now be reached on http:https://127.0.0.1:10001/

Interactive API Docs

If you go to http:https://127.0.0.1:10001/docs you will see the automatic interactive API documentation generated with Swagger UI

Alternatively you can go to http:https://127.0.0.1/redoc see the automatic interactive API documentation generated with Redoc

Links

Other example projects

About

Demo project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%