bbs-backend/defs.py
2023-04-23 16:01:46 +08:00

21 lines
544 B
Python

import asyncio
from fastapi import FastAPI
from starlette.middleware.trustedhost import TrustedHostMiddleware
from fastapi.middleware.cors import CORSMiddleware
from models.sqlite import Sqlite
loop = asyncio.get_event_loop()
app = FastAPI()
app.add_middleware(
TrustedHostMiddleware, allowed_hosts=["127.0.0.1"]
)
app.add_middleware(
CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"]
)
sqlite = Sqlite()
need_auth_routes = []
need_auth_uid_only_routes = []
need_admin_routes = []