feat(API): Added CORSMiddleware.
Browse files- src/app.py +8 -0
src/app.py
CHANGED
|
@@ -1,10 +1,18 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
|
| 3 |
from src.handlers import router
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
def get_application() -> FastAPI:
|
| 7 |
application = FastAPI()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
application.include_router(router)
|
| 9 |
|
| 10 |
return application
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
|
| 3 |
from src.handlers import router
|
| 4 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 5 |
|
| 6 |
|
| 7 |
def get_application() -> FastAPI:
|
| 8 |
application = FastAPI()
|
| 9 |
+
application.add_middleware(
|
| 10 |
+
CORSMiddleware,
|
| 11 |
+
allow_origins=["*"],
|
| 12 |
+
allow_credentials=True,
|
| 13 |
+
allow_methods=["*"],
|
| 14 |
+
allow_headers=["*"],
|
| 15 |
+
)
|
| 16 |
application.include_router(router)
|
| 17 |
|
| 18 |
return application
|