Just to show an example of backend code with endpoints, this mini project uses FastAPI for setting up a server on the default localhost port 8000.
- FastAPI
- Pydantic
FastAPI is the heart of this project. It's very fast, and with recent updates to Python, it competes with other frameworks like Node.js, Django's RestFramework, and Flask.
For creating models of data, Pydantic is used for validation and parsing of payloads.
For entering menu items, POST a new item at http://localhost:8000/docs/ and then use GET and DELETE endpoints to alter the menu_items dictionary.
NOTE: Wherever the menu_items dictionary is referenced, normally there would be a repository call using something like SQLAlchemy.
simple_client.py can be executed while server is running or debugging to see a simple POST and GET request.