FastAPI vocabulary: Journeyman level
16 FastAPI terms at the Journeyman level, each with a short definition and a link to its full page.
Updated
- Annotated
- Attaches extra info like `Query` or `Depends` to a type hint.
- APIRouter
- Groups related endpoints so the app can be split into files.
- Background Tasks
- Work that runs after the response is sent, like sending an email.
- CORS Middleware
- Lets web pages on other domains call the API.
- Dependency Injection in FastAPI
- FastAPI running helper functions and passing their results into endpoints.
- Depends()
- Marks a parameter whose value comes from calling a dependency function.
- Exception Handler
- A function registered with @app.exception_handler(SomeError) that FastAPI calls whenever that exception reaches it from any route, and that returns the answer to send.
- Field Validation
- Rules on a model field, like min, max or length, added with `Field()`.
- File Upload
- Accepts uploaded files with `UploadFile`.
- Form Data
- Reads HTML form fields instead of JSON.
- Middleware
- Code that runs around every request, before and after the endpoint.
- Nested Model
- A Pydantic model used as the type of another model's field, so a JSON object inside a request body is checked by its own model, such as home: Home.
- Settings with pydantic-settings
- Loads environment variables into a typed settings class.
- SQLModel
- A library where one class is both a database table and an API model.
- Tags
- Labels that group endpoints under headings in the docs.
- TestClient
- Sends requests to the app in tests without a server.