feat(app): add html weather view
This commit is contained in:
37
gismeteo/route/doc/__init__.py
Normal file
37
gismeteo/route/doc/__init__.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from anyio import Path
|
||||
from fastapi import FastAPI
|
||||
from fastapi.openapi.docs import (
|
||||
get_redoc_html,
|
||||
get_swagger_ui_html,
|
||||
get_swagger_ui_oauth2_redirect_html,
|
||||
)
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
|
||||
def mount(app: FastAPI):
|
||||
app.mount(
|
||||
"/docs/static",
|
||||
StaticFiles(directory=Path(__file__).parent / "static"),
|
||||
)
|
||||
|
||||
@app.get("/docs", include_in_schema=False)
|
||||
async def custom_swagger_ui_html():
|
||||
return get_swagger_ui_html(
|
||||
openapi_url=app.openapi_url,
|
||||
title=app.title + " - Swagger UI",
|
||||
oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url,
|
||||
swagger_js_url="docs/static/swagger-ui-bundle.js",
|
||||
swagger_css_url="docs/static/swagger-ui.css",
|
||||
)
|
||||
|
||||
@app.get(app.swagger_ui_oauth2_redirect_url, include_in_schema=False)
|
||||
async def swagger_ui_redirect():
|
||||
return get_swagger_ui_oauth2_redirect_html()
|
||||
|
||||
@app.get("/redoc", include_in_schema=False)
|
||||
async def redoc_html():
|
||||
return get_redoc_html(
|
||||
openapi_url=app.openapi_url,
|
||||
title=app.title + " - ReDoc",
|
||||
redoc_js_url="docs/static/redoc.standalone.js",
|
||||
)
|
||||
1782
gismeteo/route/doc/static/redoc.standalone.js
vendored
Normal file
1782
gismeteo/route/doc/static/redoc.standalone.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
gismeteo/route/doc/static/swagger-ui-bundle.js
vendored
Normal file
2
gismeteo/route/doc/static/swagger-ui-bundle.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3
gismeteo/route/doc/static/swagger-ui.css
vendored
Normal file
3
gismeteo/route/doc/static/swagger-ui.css
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user