32 lines
722 B
Python
32 lines
722 B
Python
|
|
from fastapi import FastAPI
|
||
|
|
from fastapi.middleware.cors import CORSMiddleware
|
||
|
|
from .routers import auth, rooms, tracks, websocket, messages
|
||
|
|
|
||
|
|
app = FastAPI(title="EnigFM", description="Listen to music together with friends")
|
||
|
|
|
||
|
|
# CORS
|
||
|
|
app.add_middleware(
|
||
|
|
CORSMiddleware,
|
||
|
|
allow_origins=["*"],
|
||
|
|
allow_credentials=True,
|
||
|
|
allow_methods=["*"],
|
||
|
|
allow_headers=["*"],
|
||
|
|
)
|
||
|
|
|
||
|
|
# Routers
|
||
|
|
app.include_router(auth.router)
|
||
|
|
app.include_router(rooms.router)
|
||
|
|
app.include_router(tracks.router)
|
||
|
|
app.include_router(messages.router)
|
||
|
|
app.include_router(websocket.router)
|
||
|
|
|
||
|
|
|
||
|
|
@app.get("/")
|
||
|
|
async def root():
|
||
|
|
return {"message": "EnigFM API", "version": "1.0.0"}
|
||
|
|
|
||
|
|
|
||
|
|
@app.get("/health")
|
||
|
|
async def health():
|
||
|
|
return {"status": "ok"}
|