.. _api-reference: API Reference ============= This page contains the complete API reference for all custom endpoints that are running on the backend server. Once you have the server running locally, you can access the API via the following url: http://localhost:3001/api. .. openapi:: ../openapi.json Source Code Links ----------------- .. note:: **View Source Code**: Each API endpoint is implemented in `server.js `_. Click on any endpoint below to see its implementation details. All API endpoints are defined in the following file: - `server.js `_ - Main API server with all route handlers Quick Reference - Endpoint Locations in server.js: - `GET / `_ - Line 107 - `GET /api/health `_ - Line 116 - `POST /api/register `_ - Line 140 (Admin only) - `POST /api/login `_ - Line 197 - `GET /api/me `_ - Line 294 - `GET /api/current-stock `_ - Line 315 - `GET /api/daily-summary `_ - Line 329 - `GET /api/store-performance `_ - Line 356 - `GET /api/item-performance `_ - Line 370 - `GET /api/out-of-stock `_ - Line 421 - `GET /api/time-windows `_ - Line 448 - `GET /api/weekly-trends `_ - Line 495 - `GET /api/stores `_ - Line 524 - `GET /api/weekly-sales-stores `_ - Line 539 - `GET /api/weekly-sales-years `_ - Line 554 - `GET /api/items `_ - Line 569 - `GET /api/daily-sales `_ - Line 585 - `GET /api/weekly-sales `_ - Line 637 - `GET /api/login-logs `_ - Line 690 (Admin only)