Files
SigHej/backend/app/main.py
Henrik Jess Nielsen 99e9b509a0
Some checks failed
Backend CI / test (push) Has been cancelled
Flutter CI / analyze-and-test (push) Has been cancelled
eksplicit mapping af envs
2026-05-12 18:21:25 +02:00

35 lines
805 B
Python

from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api import health, session, match, ws, stats
from app.core.config import settings
from app.core.database import create_tables
@asynccontextmanager
async def lifespan(app: FastAPI):
await create_tables()
yield
app = FastAPI(
title="Social Proximity API",
version="0.1.0",
lifespan=lifespan,
)
app.add_middleware(
CORSMiddleware,
allow_origins=settings.allowed_origins,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(health.router)
app.include_router(session.router, prefix="/session")
app.include_router(match.router, prefix="/match")
app.include_router(ws.router)
app.include_router(stats.router, prefix="/stats")