mirror of
https://github.com/devproje/balance-application.git
synced 2024-10-20 15:11:21 +00:00
feat: cors issue fixed
This commit is contained in:
parent
eec4c71b01
commit
75e8921073
1 changed files with 7 additions and 0 deletions
7
app.py
7
app.py
|
@ -1,9 +1,16 @@
|
||||||
from fastapi import FastAPI, Response
|
from fastapi import FastAPI, Response
|
||||||
from routes.auth import router as auth
|
from routes.auth import router as auth
|
||||||
from routes.balance import router as balance
|
from routes.balance import router as balance
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
|
app.add_middleware(
|
||||||
|
CORSMiddleware,
|
||||||
|
allow_methods=["POST, GET, PATCH, DELETE"],
|
||||||
|
allow_headers=["*"]
|
||||||
|
)
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
def index(resp: Response):
|
def index(resp: Response):
|
||||||
resp.headers.setdefault("Content-Type", "text")
|
resp.headers.setdefault("Content-Type", "text")
|
||||||
|
|
Loading…
Reference in a new issue