Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| app = FastAPI() | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], # Chấp nhận tất cả (có thể đổi thành frontend của bạn) | |
| allow_credentials=True, | |
| allow_methods=["*"], # Cho phép tất cả phương thức (GET, POST,...) | |
| allow_headers=["*"], # Cho phép tất cả headers | |
| ) | |
| def greet_json(): | |
| return {"Hello": "World!1"} |