Skip to content

FastAPI

FastAPI helps to build backend REST api in python.

Boilerplate

  • Create a main with health and metrics routes
  • Add any specific routes for a business entities in its own router
  • Add dependencies to initialize singletons, reference as part of the dependencies

Running

To start an app, use uvicorn in a shell script

uvicorn orchestrator_api:app --host 0.0.0.0 --port 8000 --reload

Or add this in the main server python code:

import uvicorn

if __name__ == "__main__":
     uvicorn.run(app, host="0.0.0.0", port=8000)
  • Some URLs
http://127.0.0.1:8000/docs
http://127.0.0.1:8000/redoc

How tos

Some content to read