FastAPI, a First Look

FastAPI, a First Look: Your First FastAPI Route, Testing a Route.

Updated

  1. Your First FastAPI Route (Apprentice): FastAPI turns Python functions into a web API, where a decorator ties each function to an address, a path parameter with a type hint reads part of the address, HTTPException answers 404, fastapi dev runs the app, and /docs lets you try every route.
  2. Testing a Route (Apprentice): FastAPI's TestClient sends requests straight to your app with no server running, so pytest tests can check each route's status code and the JSON it answers with, including the 404 for an item that isn't there, every time the code changes.