File size: 1,433 Bytes
110eb15
 
5f6bdbf
110eb15
 
 
5f6bdbf
 
 
 
 
 
 
 
 
110eb15
 
 
 
5f6bdbf
110eb15
 
 
 
 
5f6bdbf
110eb15
 
 
 
 
 
5f6bdbf
 
110eb15
 
 
 
 
5f6bdbf
110eb15
 
 
 
 
 
 
5f6bdbf
110eb15
 
 
5f6bdbf
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""FastAPI application entry point."""

import logging
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

from api.schemas.response_schemas import HealthResponse
from api.routes import optim_router, dxf_router

# Configure logging
logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)

app = FastAPI(
    title="Land Redistribution Algorithm API",
    description="API for testing land subdivision and redistribution algorithms",
    version="2.0.0"
)

# Configure CORS
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

# Include routes
app.include_router(optim_router, prefix="/api")
app.include_router(dxf_router, prefix="/api")


@app.get("/health", response_model=HealthResponse)
async def health_check():
    """Health check endpoint."""
    return HealthResponse(status="healthy", version="2.0.0")


@app.get("/")
async def root():
    """Root endpoint with API information."""
    return {
        "message": "Land Redistribution Algorithm API",
        "version": "2.0.0",
        "docs": "/docs",
        "health": "/health"
    }


@app.on_event("startup")
async def startup_event():
    """Log startup information."""
    logger.info("Land Redistribution API started (v2.0.0 - Modular Architecture)")