mirror of
https://github.com/xiaozhou233/RiverWaterQualityMonitoring.git
synced 2026-12-05 21:15:55 +08:00
添加 CORS 中间件以支持跨域请求,并新增运行脚本
This commit is contained in:
1 parent
54218c7600
commit
24e140a168
2 files changed
+10
No files matched your search
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user