What is the purpose of @app.get("/") in FastAPI?

Tests your understanding of FastAPI routing. A strong answer explains that the decorator binds an HTTP method and path to a Python function, registers it in the app's route table, and builds OpenAPI metadata.
Tests whether you understand FastAPI's request dispatch and decorator-based handler registration. A strong answer covers four things in order: the decorator binds an HTTP verb and URL path to a Python function; the app stores this in an internal route registry; incoming requests are matched by method and path to invoke that function; and FastAPI auto-generates OpenAPI schema from the binding. Red flag: calling it syntax sugar or confusing it with Flask routes without mentioning automatic API docs generation.
Read the original → fastapi.tiangolo.com
- #fastapi
- #python
- #routing
- #decorators
- #openapi
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.