Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francbartoli/60e97a159bc2b7c2ea042155344c7dae to your computer and use it in GitHub Desktop.
Save francbartoli/60e97a159bc2b7c2ea042155344c7dae to your computer and use it in GitHub Desktop.
app = FastAPI(docs_url=None, redoc_url=None, openapi_url=None)
@app.get("/")
async def homepage():
return "Welcome to the security test!"
@app.get("/openapi.json")
async def get_open_api_endpoint(current_user: User = Depends(get_current_active_user)):
return JSONResponse(get_openapi(title="FastAPI", version=1, routes=app.routes))
@app.get("/docs")
async def get_documentation(current_user: User = Depends(get_current_active_user)):
return get_swagger_ui_html(openapi_url="/openapi.json", title="docs")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment