34 lines
922 B
Python
34 lines
922 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.core.database import engine, Base
|
|
from app.routers import auth, projects, songs, alternatives
|
|
from app.websocket.manager import router as ws_router
|
|
|
|
# Opret tabeller hvis de ikke findes (til udvikling — brug Alembic i produktion)
|
|
Base.metadata.create_all(bind=engine)
|
|
|
|
app = FastAPI(
|
|
title="Linedance API",
|
|
version="0.1.0",
|
|
description="Backend for linedance-afspiller og projektstyring",
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"], # Stram til i produktion
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(auth.router)
|
|
app.include_router(projects.router)
|
|
app.include_router(songs.router)
|
|
app.include_router(alternatives.router)
|
|
app.include_router(ws_router)
|
|
|
|
|
|
@app.get("/")
|
|
def root():
|
|
return {"status": "ok", "service": "Linedance API"}
|