-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (31 loc) · 954 Bytes
/
main.py
File metadata and controls
38 lines (31 loc) · 954 Bytes
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
35
36
37
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from core.config_loader import settings
from auth.routes.auth_router import auth_router
from user.routes.user_router import user_router
openapi_tags = [
{
"name": "Users",
"description": "User operations",
},
{
"name": "Health Checks",
"description": "Application health checks",
}
]
app = FastAPI(openapi_tags=openapi_tags)
if settings.BACKEND_CORS_ORIGINS:
app.add_middleware(
CORSMiddleware,
allow_origins=[
str(origin).strip("/") for origin in settings.BACKEND_CORS_ORIGINS
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(auth_router, prefix='/api')
app.include_router(user_router, prefix='/api', tags=['Users'])
@app.get("/health", tags=['Health Checks'])
def read_root():
return {"health": "true"}