-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (28 loc) · 755 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
33
34
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.param_functions import Depends
from fastapi.staticfiles import StaticFiles
from utils.auth_util import AuthHandler
from routers import auth_route, user_route
app = FastAPI()
auth = AuthHandler()
origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.mount("/assets", StaticFiles(directory="assets/"), name="assets")
app.include_router(
auth_route.router,
prefix="/auth",
tags=["Manage Auth"]
)
app.include_router(
user_route.router,
prefix="/users",
tags=["Manage Users"],
dependencies=[Depends(auth.auth_wrapper)]
)