File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from fastapi import APIRouter
22from fastapi .responses import RedirectResponse
3- from fastapi .openapi .docs import get_swagger_ui_html
43from dotenv import load_dotenv
54import os
65
@@ -18,15 +17,3 @@ class RootController:
1817 @router .get ("/" , include_in_schema = False )
1918 def get_root ():
2019 return RedirectResponse (url = "/docs" if PROXY_PATH is None else f"/{ PROXY_PATH } /docs" )
21-
22- @staticmethod
23- @router .get ("/docs" , include_in_schema = False )
24- @router .get ("/docs/" , include_in_schema = False )
25- def get_swagger_ui_html ():
26- return get_swagger_ui_html (
27- openapi_url = router .openapi_url ,
28- title = router .title ,
29- swagger_js_url = "https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js" ,
30- swagger_css_url = "https://unpkg.com/swagger-ui-dist@5/swagger-ui.css" ,
31- )
32-
Original file line number Diff line number Diff line change 22import pkgutil
33from fastapi import FastAPI
44from fastapi .middleware .cors import CORSMiddleware
5+ from fastapi .openapi .docs import get_swagger_ui_html
56from controllers import __path__ as controllers_path
67from dotenv import load_dotenv
78import os
3334 title = "IHR API" ,
3435 description = description ,
3536 version = "v1.11" ,
37+ docs_url = None ,
3638 redoc_url = None ,
3739 redirect_slashes = False ,
3840)
4345 if hasattr (module , "router" ):
4446 app .include_router (module .router )
4547
48+ @app .get ("/docs" , include_in_schema = False )
49+ @app .get ("/docs/" , include_in_schema = False )
50+ def swagger_ui_html ():
51+ return get_swagger_ui_html (
52+ openapi_url = app .openapi_url ,
53+ title = app .title ,
54+ swagger_js_url = "https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js" ,
55+ swagger_css_url = "https://unpkg.com/swagger-ui-dist@5/swagger-ui.css" ,
56+ )
57+
4658origins = [
4759 "http://localhost:5173" ,
4860 "http://www.ihr.live" ,
You can’t perform that action at this time.
0 commit comments