
- Create project structure with FastAPI and SQLAlchemy - Implement database models for items, categories, suppliers, and stock movements - Add CRUD operations for all models - Configure Alembic for database migrations - Create RESTful API endpoints for inventory management - Add health endpoint for system monitoring - Update README with setup and usage instructions generated with BackendIM... (backend.im)
30 lines
883 B
Python
30 lines
883 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.routes import item_routes, category_routes, supplier_routes, stock_routes, health_routes
|
|
from app.database import engine, Base
|
|
|
|
app = FastAPI(
|
|
title="Small Business Inventory Management System",
|
|
description="API for managing inventory for small businesses",
|
|
version="1.0.0"
|
|
)
|
|
|
|
# Add CORS middleware
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include routers
|
|
app.include_router(health_routes.router)
|
|
app.include_router(item_routes.router)
|
|
app.include_router(category_routes.router)
|
|
app.include_router(supplier_routes.router)
|
|
app.include_router(stock_routes.router)
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) |