36 lines
849 B
Python

from fastapi import FastAPI
import uvicorn
from pathlib import Path
from app.database import engine
from app.models import Base
from app.routers import users_router
# Create database directory (won't error if it already exists)
DB_DIR = Path("/app") / "storage" / "db"
DB_DIR.mkdir(parents=True, exist_ok=True)
# Create database tables
Base.metadata.create_all(bind=engine)
app = FastAPI(
title="Generic REST API Service",
description="A basic REST API service with user authentication",
version="0.1.0",
docs_url="/docs",
redoc_url="/redoc",
)
# Include routers
app.include_router(users_router)
@app.get("/health", tags=["Health"])
async def health():
"""Check if the API is healthy."""
return {"status": "healthy"}
if __name__ == "__main__":
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)