tezvyn:

FastAPI: Mounting Independent Sub-Applications

Source: fastapi.tiangolo.comadvanced

Mounting delegates a URL prefix to a separate FastAPI app, giving it its own isolated logic and API docs. Use it to combine microservices or isolate domains. The footgun: the main app's dependencies and middleware do not apply to the sub-app.

Mounting in FastAPI delegates a URL prefix to a completely separate application. This sub-app operates in isolation, with its own OpenAPI schema, API docs, dependencies, and middleware. This is ideal for composing a system from independent microservices behind a single gateway or for cleanly separating large business domains within a monolith. The footgun is assuming shared context; the main app's dependencies and middleware do not cascade down to the mounted sub-app.

Read the original → fastapi.tiangolo.com

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.

FastAPI: Mounting Independent Sub-Applications · Tezvyn