Rohan014 commited on
Commit
b883b66
·
verified ·
1 Parent(s): 962f126

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +13 -2
main.py CHANGED
@@ -1,16 +1,27 @@
1
- from fastapi import FastAPI
2
  import os
 
 
3
 
4
  app = FastAPI(title="Deployment Observability API")
5
 
 
 
 
 
 
 
 
 
 
6
  @app.get("/")
7
  async def root():
8
  return {
9
  "status": "healthy",
10
  "service": "deployment-ready-ga2-e8c0f1",
11
- "port": 7152,
12
  }
13
 
 
14
  @app.get("/health")
15
  async def health():
16
  return {"status": "ok"}
 
 
1
  import os
2
+ from fastapi import FastAPI
3
+ from fastapi.middleware.cors import CORSMiddleware
4
 
5
  app = FastAPI(title="Deployment Observability API")
6
 
7
+ app.add_middleware(
8
+ CORSMiddleware,
9
+ allow_origins=["*"],
10
+ allow_credentials=True,
11
+ allow_methods=["*"],
12
+ allow_headers=["*"],
13
+ )
14
+
15
+
16
  @app.get("/")
17
  async def root():
18
  return {
19
  "status": "healthy",
20
  "service": "deployment-ready-ga2-e8c0f1",
21
+ "port": int(os.environ.get("APP_PORT", 7152)),
22
  }
23
 
24
+
25
  @app.get("/health")
26
  async def health():
27
  return {"status": "ok"}