Louis_Mlr commited on
Commit
f7bba10
Β·
1 Parent(s): bf37537

Initial API deployment

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -6,6 +6,7 @@ DΓ©ployΓ© comme un Space HF gratuit (FastAPI / Docker).
6
 
7
  from fastapi import FastAPI
8
  from fastapi.middleware.cors import CORSMiddleware
 
9
 
10
  app = FastAPI(title="Patient Context API")
11
 
@@ -17,6 +18,16 @@ app.add_middleware(
17
  allow_headers=["*"],
18
  )
19
 
 
 
 
 
 
 
 
 
 
 
20
  # ──────────────────────────────────────────────
21
  # Base de donnΓ©es fictive (dict simple)
22
  # ClΓ© = patient_id, Valeur = fiche patient
 
6
 
7
  from fastapi import FastAPI
8
  from fastapi.middleware.cors import CORSMiddleware
9
+ from fastapi.responses import JSONResponse
10
 
11
  app = FastAPI(title="Patient Context API")
12
 
 
18
  allow_headers=["*"],
19
  )
20
 
21
+
22
+ @app.middleware("http")
23
+ async def force_json_headers(request, call_next):
24
+ response = await call_next(request)
25
+ response.headers["Access-Control-Allow-Origin"] = "*"
26
+ response.headers["Access-Control-Allow-Headers"] = "*"
27
+ response.headers["X-Frame-Options"] = "ALLOWALL"
28
+ return response
29
+
30
+
31
  # ──────────────────────────────────────────────
32
  # Base de donnΓ©es fictive (dict simple)
33
  # ClΓ© = patient_id, Valeur = fiche patient