mirror of
https://github.com/rjNemo/graphql-file_upload
synced 2026-06-06 02:16:44 +00:00
19 lines
567 B
Python
19 lines
567 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from .config import ALLOWED_HOSTS, DEBUG, PROJECT_NAME, VERSION
|
|
from .graphql import mount_graphql
|
|
|
|
|
|
def get_application() -> FastAPI:
|
|
app = FastAPI(title=PROJECT_NAME, debug=DEBUG, version=VERSION)
|
|
# middleware are executed in reverse order (it's an onion)
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=ALLOWED_HOSTS or ["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
return mount_graphql(app)
|