-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
32 lines (26 loc) · 837 Bytes
/
main.py
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
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from cruds.init import init_base_sign, init_item, init_leveling
from db.database import engine
from db.models import Base
from routers.graphql import graphql_router
from routers.websocket import websocket_router
from fastapi.staticfiles import StaticFiles
Base.metadata.create_all(bind=engine)
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_credentials=True,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
)
app.mount("/static", StaticFiles(directory="./assets/image/X100-2/"), name="static")
init_base_sign()
init_item()
init_leveling()
@app.get('/')
async def health():
return {'health': 'OK'}
app.include_router(graphql_router, prefix='/graphql')
app.include_router(websocket_router, prefix='/ws')