17 lines
395 B
Python
17 lines
395 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
app = FastAPI()
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"], # oppure ["http://localhost:4200"] se vuoi essere più restrittivo
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
@app.get("/api/hello")
|
|
def hello():
|
|
return {"message": "Hello from Python API"}
|