init project
This commit is contained in:
16
backend/main.py
Normal file
16
backend/main.py
Normal file
@@ -0,0 +1,16 @@
|
||||
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"}
|
||||
Reference in New Issue
Block a user