Files
hvac_end_python/app/app_config.py
2025-09-29 16:49:43 +08:00

21 lines
396 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from api.modbus_api import modbus
app = FastAPI()
'''
添加CORS中间件允许跨域请求
'''
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(modbus, prefix="/modbus", tags=["modbus的api"])