40 lines
1.0 KiB
Python
40 lines
1.0 KiB
Python
# app/main.py - Refactored API Structure
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.config import settings
|
|
from app.routers import health, green_spaces, amenities, info, admin
|
|
|
|
# Create FastAPI app
|
|
app = FastAPI(
|
|
title="Berlin Green Space Personality Scorer",
|
|
description="Score any green space in Berlin based on personality preferences",
|
|
version="1.0.0"
|
|
)
|
|
|
|
# Add CORS middleware
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"], # Configure appropriately for production
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include routers
|
|
app.include_router(health.router)
|
|
app.include_router(green_spaces.router)
|
|
app.include_router(amenities.router)
|
|
app.include_router(info.router)
|
|
app.include_router(admin.router)
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
"""Root endpoint with API information."""
|
|
return {
|
|
"message": "Berlin Green Space Personality Scorer API",
|
|
"version": "1.0.0",
|
|
"docs": "/docs",
|
|
"health": "/health"
|
|
}
|