47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.config import settings
|
|
from app.routers import auth, maps, items, map_share, websocket
|
|
|
|
# Create FastAPI application
|
|
app = FastAPI(
|
|
title="ISP Wiremap API",
|
|
description="API for ISP cable and network infrastructure mapping",
|
|
version="1.0.0"
|
|
)
|
|
|
|
# Configure CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=settings.cors_origins,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Register routers
|
|
app.include_router(auth.router)
|
|
app.include_router(maps.router)
|
|
app.include_router(items.router)
|
|
app.include_router(map_share.router)
|
|
app.include_router(websocket.router)
|
|
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
"""Root endpoint for API health check."""
|
|
return {
|
|
"message": "ISP Wiremap API",
|
|
"version": "1.0.0",
|
|
"status": "running"
|
|
}
|
|
|
|
|
|
@app.get("/api/health")
|
|
async def health_check():
|
|
"""Health check endpoint for monitoring."""
|
|
return {
|
|
"status": "healthy",
|
|
"environment": settings.ENVIRONMENT
|
|
}
|