What is FastAPI?

From the FastAPI website:

FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.

What does this mean? It means that FastAPI allows to quickly build and develop APIs with some powerful features:

  • OpenAPI for API declaration
  • Automatic data model documentation with JSON Schema
  • Automatic client code generation in many languages
  • Automatic docs with  Swagger UI (allows testing the API from the docs) and  ReDoc
  • Standard Python type declarations, no new syntax needed
  • Sensible defaults
  • Validations for all Python types, including JSON dict and list, all the way to URL and Email
  • Security and Authentication with HTTP Basic, OAuth2 and passing of api keys

Building a quick API with FastAPI

First step is, of course, to install FastAPI with PIP:

pip install fastapi

We also need to install a ASGI server to run and test the API:

pip install uvicorn

#nginx #python #docker #api

How to Deploy a Python API with FastAPI with Nginx and Docker
75.00 GEEK