42 lines
908 B
Python
42 lines
908 B
Python
"""Main module."""
|
|
|
|
import logging
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from src.dataprocessor.router import router as dataprocessor_router
|
|
from src.dataquery.router import router as dataquery_router
|
|
|
|
# Configure logging
|
|
logging.basicConfig(level=logging.INFO)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
# Initialize FastAPI app
|
|
app = FastAPI(
|
|
title="PowerOn Preprocessing App",
|
|
version="0.1.0",
|
|
)
|
|
|
|
|
|
# Configure CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
|
|
# Include routers
|
|
app.include_router(
|
|
dataprocessor_router, prefix="/api/v1/dataprocessor", tags=["dataprocessor"]
|
|
)
|
|
app.include_router(dataquery_router, prefix="/api/v1/dataquery", tags=["dataquery"])
|
|
|
|
|
|
# Add a simple root endpoint
|
|
@app.get("/")
|
|
async def root():
|
|
return {"status": "OK"}
|