30 lines
684 B
Python
30 lines
684 B
Python
import os
|
|
from typing import Literal
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from pydantic import BaseModel
|
|
|
|
app = FastAPI(title="Entroia Backend", version="0.1.0")
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=[
|
|
origin.strip()
|
|
for origin in os.getenv(
|
|
"CORS_ORIGINS", "http://localhost:3000,http://localhost:5173"
|
|
).split(",")
|
|
if origin.strip()
|
|
],
|
|
allow_methods=["GET"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
|
|
class HealthResponse(BaseModel):
|
|
status: Literal["ok"] = "ok"
|
|
|
|
|
|
@app.get("/health", response_model=HealthResponse)
|
|
def health() -> HealthResponse:
|
|
return HealthResponse()
|