CORS追加
This commit is contained in:
@@ -27,5 +27,5 @@ class Kintone(Base):
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
type = Column(Integer, index=True, nullable=False)
|
||||
name = Column(String(100), nullable=False)
|
||||
desc = Column(String(500))
|
||||
content = Column(String(2000))
|
||||
desc = Column(String)
|
||||
content = Column(String)
|
||||
@@ -10,7 +10,7 @@ from app.db import Base,engine
|
||||
from app.core.auth import get_current_active_user
|
||||
from app.core.celery_app import celery_app
|
||||
from app import tasks
|
||||
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
@@ -18,6 +18,19 @@ app = FastAPI(
|
||||
title=config.PROJECT_NAME, docs_url="/api/docs", openapi_url="/api"
|
||||
)
|
||||
|
||||
origins = [
|
||||
"http://localhost:9000",
|
||||
"http://localhost",
|
||||
"http://localhost:8080",
|
||||
]
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# @app.middleware("http")
|
||||
# async def db_session_middleware(request: Request, call_next):
|
||||
|
||||
Reference in New Issue
Block a user