36 lines
899 B
Python
36 lines
899 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.core.config import settings
|
|
from app.routers import auth, customers, invoices
|
|
|
|
app = FastAPI(
|
|
title=settings.PROJECT_NAME,
|
|
openapi_url="/openapi.json",
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(auth.router, prefix="/auth", tags=["authentication"])
|
|
app.include_router(customers.router, prefix="/customers", tags=["customers"])
|
|
app.include_router(invoices.router, prefix="/invoices", tags=["invoices"])
|
|
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {
|
|
"title": settings.PROJECT_NAME,
|
|
"documentation": "/docs",
|
|
"health_check": "/health"
|
|
}
|
|
|
|
|
|
@app.get("/health")
|
|
async def health_check():
|
|
return {"status": "healthy", "service": settings.PROJECT_NAME} |