Coverage for docs_src/behind_a_proxy/tutorial004.py: 100%
5 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
1from fastapi import FastAPI, Request 1abcde
3app = FastAPI( 1abcde
4 servers=[
5 {"url": "https://stag.example.com", "description": "Staging environment"},
6 {"url": "https://prod.example.com", "description": "Production environment"},
7 ],
8 root_path="/api/v1",
9 root_path_in_servers=False,
10)
13@app.get("/app") 1abcde
14def read_main(request: Request): 1abcde
15 return {"message": "Hello World", "root_path": request.scope.get("root_path")} 1abcde