Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
from fastapi.middleware.cors import CORSMiddleware
|
3 |
+
from app.config import settings
|
4 |
+
from app.api.endpoints import market, funds, portfolio, goals, ai
|
5 |
+
|
6 |
+
app = FastAPI(
|
7 |
+
title=settings.PROJECT_NAME,
|
8 |
+
openapi_url=f"{settings.API_V1_STR}/openapi.json"
|
9 |
+
)
|
10 |
+
|
11 |
+
# Set up CORS middleware
|
12 |
+
app.add_middleware(
|
13 |
+
CORSMiddleware,
|
14 |
+
allow_origins=settings.BACKEND_CORS_ORIGINS,
|
15 |
+
allow_credentials=True,
|
16 |
+
allow_methods=["*"],
|
17 |
+
allow_headers=["*"],
|
18 |
+
)
|
19 |
+
|
20 |
+
# Include API routers
|
21 |
+
app.include_router(market.router, prefix=f"{settings.API_V1_STR}/market", tags=["market"])
|
22 |
+
app.include_router(funds.router, prefix=f"{settings.API_V1_STR}/funds", tags=["funds"])
|
23 |
+
app.include_router(portfolio.router, prefix=f"{settings.API_V1_STR}/portfolio", tags=["portfolio"])
|
24 |
+
app.include_router(goals.router, prefix=f"{settings.API_V1_STR}/goals", tags=["goals"])
|
25 |
+
app.include_router(ai.router, prefix=f"{settings.API_V1_STR}/ai", tags=["ai"])
|
26 |
+
|
27 |
+
@app.get("/")
|
28 |
+
async def root():
|
29 |
+
return {"message": "Mutual Fund Investment Decision Support System API"}
|
30 |
+
|
31 |
+
@app.get("/health")
|
32 |
+
async def health_check():
|
33 |
+
return {"status": "healthy"}
|