Member-only story
Building REST API with Python, Falcon, and MongoDB
5 min readOct 9, 2023
The purpose of this story is to explain how to implement a simple REST API with Python, Falcon, and MongoDB, deploy, and run it inside a docker container.
· Prerequisites
· Overview
∘ What Is Falcon Web Framework?
∘ Why use Falcon for microservices?
· Let’s code
∘ MongoDB setup
∘ Set up Falcon
∘ Project Structure
∘ Create models
∘ Resources
∘ Configure WSGI server
· Build and Run the Service Using Docker Compose
· Test the REST API:
· Conclusion
· References
Prerequisites
- Docker (20.x.x or above)
- Docker-compose (2.5+)
- Python 3.5 or above
- Falcon 3.x.x
Overview
In this story, we are going to build a book API where the user can create a book, update the book, and fetch the book by id.