feat: cors issue fixed

This commit is contained in:
Project_IO 2024-09-10 21:20:03 +09:00
parent eec4c71b01
commit 75e8921073

7
app.py
View file

@ -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")