
- Set up FastAPI application with SQLite database - Implemented CRUD operations for inventory items, categories, and suppliers - Added Alembic migrations for database schema management - Configured CORS middleware for cross-origin requests - Added health check and API documentation endpoints - Structured project with proper separation of concerns - Added comprehensive README with API documentation
34 lines
845 B
Python
34 lines
845 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.api.inventory import router as inventory_router
|
|
|
|
app = FastAPI(
|
|
title="Small Business Inventory Management System",
|
|
description="A FastAPI-based inventory management system for small businesses",
|
|
version="1.0.0",
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(inventory_router, prefix="/api/inventory", tags=["inventory"])
|
|
|
|
|
|
@app.get("/")
|
|
def read_root():
|
|
return {
|
|
"title": "Small Business Inventory Management System",
|
|
"documentation": "/docs",
|
|
"health_check": "/health",
|
|
}
|
|
|
|
|
|
@app.get("/health")
|
|
def health_check():
|
|
return {"status": "healthy", "service": "inventory-management-system"}
|