AgentSkillsCN

FastAPI CORS Setup

允许前端来源访问。

SKILL.md
--- frontmatter
name: FastAPI CORS Setup
description: Allow frontend origins
triggers: cors, origin, cross, preflight, OPTIONS

Add to FastAPI app: from fastapi.middleware.cors import CORSMiddleware

app.add_middleware( CORSMiddleware, allow_origins=["http://localhost:3000"], allow_credentials=True, allow_methods=[""], allow_headers=[""], )