-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
43 lines (40 loc) · 1.28 KB
/
main.py
File metadata and controls
43 lines (40 loc) · 1.28 KB
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
38
39
40
41
42
43
from fastapi import FastAPI
from utils.lifespan_handlers import token_cleaner
from endpoints import auth, loans, admin, sync
app = FastAPI(
lifespan=token_cleaner,
title="Prediction Service",
description="Service en ligne de prédiction de l'accord d'un prêt bancaire",
openapi_tags=[
{
"name": "auth",
"description": "Authentication endpoints."
},
{
"name": "loans",
"description": "Loan request and history endpoints."
},
{
"name": "admin",
"description": "Admin-related endpoints."
},
{
"name": "sync",
"description": "Admin-sync related endpoints."
}
]
)
# Include the routers with unique prefixes
app.include_router(auth.router, prefix="/auth", tags=["auth"])
app.include_router(loans.router, prefix="/loans", tags=["loans"])
app.include_router(admin.router, prefix="/admin", tags=["admin"])
app.include_router(sync.router, prefix="/sync", tags=["sync"])
# Optional: Add middleware for CORS if needed
from fastapi.middleware.cors import CORSMiddleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # Adjust this to your needs
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)