Skip to content

Commit

Permalink
cors
Browse files Browse the repository at this point in the history
  • Loading branch information
Matheusafonsouza committed Nov 20, 2023
1 parent 6b8c0ec commit 09f0503
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gestao/web/application.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from importlib import metadata

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import UJSONResponse

from gestao.web.api.router import api_router
Expand All @@ -24,6 +25,15 @@ def get_app() -> FastAPI:
default_response_class=UJSONResponse,
)

origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)

# Adds startup and shutdown events.
register_startup_event(app)
register_shutdown_event(app)
Expand Down

0 comments on commit 09f0503

Please sign in to comment.