Initial commit: Waste Collection API
This commit is contained in:
42
app/main.py
Normal file
42
app/main.py
Normal file
@@ -0,0 +1,42 @@
|
||||
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",
|
||||
}
|
||||
Reference in New Issue
Block a user