Join GitHub today
Add Open API prefix route - correct docs behind reverse proxy #26
I run a lot of services in Kubernetes using Ambassador as my API Gateway. Ambassador allows you to configure a route prefix for each one of your services and then it handles ingress and routing to the initial service. This PR enables me to configure the same prefix I use with Ambassador in the Swagger UI API docs.
prefix='/service1' app = FastAPI( openapi_prefix=prefix ) @app.get('/something') => SwaggerRoute (GET - /service1/something)
NOTE: This is not the same as using the include_router method and adding a prefix.
BTW: Awesome Project! Thanks so much for your work on this, I'm using fastapi a ton these days.
@@ Coverage Diff @@ ## master #26 +/- ## ===================================== Coverage 100% 100% ===================================== Files 95 99 +4 Lines 2484 2582 +98 ===================================== + Hits 2484 2582 +98
Feb 14, 2019
I just released
Also, the relevant docs are here: https://fastapi.tiangolo.com/tutorial/sub-applications-proxy/