Member-only story
Create a fast auto-documented, maintainable and easy-to-use Python API — CRUD routes and routing management
Learn how to catch requests and obtain the information that they carry
In the previous article we’ve set up an API in 5 lines of code. We’ve install our dependencies and created a working API with just one simple route. In this article we’ll build further, fleshing out the API with multiple, different routes that’ll show you all the things you can do with FastAPI. Then we’ll focus on how to organize all of these routes in a concise and clear way
Setting up
To make this article as understandable as possible we’re going to pretend we’re coding an API for our blogging website. The goal is to create some common routes with which we can CRUD (create, read, update, delete):
- add new article
- retrieve articles from the database
- update articles to fix typo’s e.g.
- delete an article
We’ll focus on catching the requests and extracting the information. How our API communicates with our database is another topic that’s described perfectly well in this article. Also check out this article for creating a version controlled database structure.