update
This commit is contained in:
@@ -14,12 +14,13 @@ app = FastAPI()
|
||||
# 允许所有来源跨域访问(不推荐用于生产环境)
|
||||
origins = ["*"]
|
||||
|
||||
# 设置CORS(跨域资源共享)策略
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=origins,
|
||||
allow_origins=["*"], # 允许所有来源
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"], # 允许所有HTTP方法
|
||||
allow_headers=["*"], # 允许所有HTTP头
|
||||
allow_methods=["*"], # 允许所有方法
|
||||
allow_headers=["*"], # 允许所有请求头
|
||||
)
|
||||
# 依赖注入
|
||||
def get_db():
|
||||
|
||||
Reference in New Issue
Block a user