-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication.py
32 lines (26 loc) · 828 Bytes
/
application.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
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from backend.app.main import app
import os
# Create FastAPI application
application = FastAPI()
# Add CORS middleware
application.add_middleware(
CORSMiddleware,
allow_origins=["https://getgit789.github.io", "http://localhost:3000", "http://localhost:5500"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"]
)
# Include the main app's router
application.include_router(app.router)
# Health check endpoint
@application.get("/health")
def health_check():
return {"status": "healthy"}
# AWS EB looks for an 'application' callable by default
app = application
if __name__ == "__main__":
import uvicorn
port = int(os.getenv("PORT", 8000))
uvicorn.run("application:app", host="0.0.0.0", port=port)