1212from beanie import init_beanie
1313from fastapi import FastAPI
1414from fastapi .middleware .cors import CORSMiddleware
15+ from fastapi .openapi .docs import get_swagger_ui_html
16+ from fastapi .staticfiles import StaticFiles
1517from mangum import Mangum
1618from starlette .middleware .sessions import SessionMiddleware
1719
2729"""
2830
2931app = FastAPI (
30- redoc_url = None , # Disable redoc, keep only swagger
32+ redoc_url = None ,
33+ docs_url = None ,
3134 title = "SoleSearch" ,
3235 version = __version__ ,
33- contact = {"name" : "SoleSearch Emails Support" , "email" : "support@solesearch.io" },
36+ contact = {"name" : "SoleSearch Email Support" , "email" : "support@solesearch.io" },
3437 description = desc ,
3538 responses = {404 : {"description" : "Not found" }}, # Custom 404 page
3639)
3740
41+ # Serve static files from the /static directory
42+ app .mount ("/static" , StaticFiles (directory = "static" ), name = "static" )
43+
3844# Enable CORS
3945app .add_middleware (
4046 CORSMiddleware ,
@@ -59,6 +65,16 @@ async def startup_event():
5965 app .include_router (auth .router )
6066
6167
68+ @app .get ("/docs" , include_in_schema = False )
69+ async def swagger_ui_html ():
70+ return get_swagger_ui_html (
71+ openapi_url = app .openapi_url ,
72+ title = app .title + " - Documentation" ,
73+ oauth2_redirect_url = app .swagger_ui_oauth2_redirect_url ,
74+ swagger_favicon_url = "/static/favicon.png" ,
75+ )
76+
77+
6278# This is the entry point for AWS Lambda
6379handler = Mangum (app )
6480
0 commit comments