Spaces:
Build error
Build error
File size: 1,202 Bytes
5285b72 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
from starlette.applications import Starlette
from starlette.middleware import Middleware
from starlette.responses import FileResponse
from starlette.routing import Mount, Route, WebSocketRoute
from starlette.staticfiles import StaticFiles
from content_size_limit_asgi import ContentSizeLimitMiddleware
from .graphql import graphql_app
from .logger import init_logger
from .cache import cache_questions, cache_generate_summary
init_logger()
app = Starlette(
debug=True,
on_startup=[cache_questions.connect, cache_generate_summary.connect],
on_shutdown=[cache_questions.disconnect, cache_generate_summary.disconnect],
middleware=[
Middleware(
ContentSizeLimitMiddleware,
max_content_size=1024 * 32,
),
],
routes=[
Route(
"/graphql", graphql_app.handle_request, methods=["GET", "POST", "OPTIONS"]
),
WebSocketRoute("/ws/graphql", graphql_app.handle_websocket),
Mount("/assets", StaticFiles(directory="build/client/assets"), name="assets"),
Mount("/favicon.ico", FileResponse("build/client/favicon.ico")),
Route("/{path:path}", FileResponse("build/client/index.html")),
],
)
|