添加 CORS 中间件以支持跨域请求,并新增运行脚本

This commit is contained in:
xiaozhou233 committed 2026-06-29 21:35:37 +08:00
1 parent 54218c7600
commit 24e140a168
2 files changed
+10

No files matched your search

+9
View File
@@ -2,6 +2,7 @@ from fastapi import FastAPI
from datetime import datetime
from data import *
from score import *
from fastapi.middleware.cors import CORSMiddleware
###
TOKEN = "mE7yG0kI"
@@ -9,6 +10,14 @@ TOKEN = "mE7yG0kI"
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=False,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
def root():
return "OK"