Anurag33Gaikwad commited on
Commit
1ac0501
·
verified ·
1 Parent(s): 642e10c

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +31 -23
main.py CHANGED
@@ -1,23 +1,31 @@
1
- from fastapi import FastAPI
2
- from fastapi.middleware.cors import CORSMiddleware
3
-
4
- from app.api import api_router
5
- from app.config import get_settings
6
-
7
- settings = get_settings()
8
-
9
- app = FastAPI(
10
- title="QuantMind Backend",
11
- version="1.0.0",
12
- description="LSTM-based stock prediction API for the QuantMind dashboard.",
13
- )
14
-
15
- app.add_middleware(
16
- CORSMiddleware,
17
- allow_origins=["*"], # tighten later
18
- allow_credentials=True,
19
- allow_methods=["*"],
20
- allow_headers=["*"],
21
- )
22
-
23
- app.include_router(api_router)
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from fastapi.middleware.cors import CORSMiddleware
3
+
4
+ from app.api import api_router
5
+ from app.config import get_settings
6
+
7
+ settings = get_settings()
8
+
9
+ app = FastAPI(
10
+ title=settings.app_name,
11
+ version="1.0.0",
12
+ description="LSTM-based stock prediction API for the QuantMind dashboard.",
13
+ )
14
+
15
+ app.add_middleware(
16
+ CORSMiddleware,
17
+ allow_origins=settings.cors_origins,
18
+ allow_credentials=True,
19
+ allow_methods=["*"],
20
+ allow_headers=["*"],
21
+ )
22
+
23
+
24
+ @app.on_event("startup")
25
+ def startup_event():
26
+ # Fail fast if critical config is missing
27
+ settings.validate()
28
+ print("[Startup] QuantMind backend initialized successfully")
29
+
30
+
31
+ app.include_router(api_router)