Spaces:
Sleeping
Sleeping
cors add
Browse files- api/main.py +5 -0
api/main.py
CHANGED
|
@@ -21,6 +21,11 @@ app.include_router(search.router)
|
|
| 21 |
app.include_router(admin.router)
|
| 22 |
app.exception_handler(generic_exception_handler)
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
@app.middleware("http")
|
| 25 |
async def log_requests(request, call_next):
|
| 26 |
start_time = datetime.utcnow()
|
|
|
|
| 21 |
app.include_router(admin.router)
|
| 22 |
app.exception_handler(generic_exception_handler)
|
| 23 |
|
| 24 |
+
app.add_middleware(CORSMiddleware, allow_origins = ["*"],
|
| 25 |
+
allow_credentials=True,
|
| 26 |
+
allow_methods=["GET","POST","PUT", "DELETE"],
|
| 27 |
+
allow_headers = ["*"])
|
| 28 |
+
|
| 29 |
@app.middleware("http")
|
| 30 |
async def log_requests(request, call_next):
|
| 31 |
start_time = datetime.utcnow()
|