43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
import logging
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from .routes import sources, collections, notifications
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
log = logging.getLogger(__name__)
|
|
|
|
app = FastAPI(
|
|
title="Waste Collection API",
|
|
description="Waste collection schedules for German municipalities with notification support",
|
|
version="1.0.0",
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# ─── Routes ────────────────────────────────────────────────────
|
|
app.include_router(sources.router)
|
|
app.include_router(collections.router)
|
|
app.include_router(notifications.router)
|
|
|
|
|
|
@app.get("/health")
|
|
def health():
|
|
return {"status": "ok"}
|
|
|
|
|
|
@app.get("/")
|
|
def root():
|
|
return {
|
|
"name": "Waste Collection API",
|
|
"version": "1.0.0",
|
|
"docs": "/docs",
|
|
"sources": "/sources",
|
|
}
|