GET /api/reports/sales
Generate an HTML sales report based on paid orders.Authentication
Required. Include JWT token inAuthorization header.
Response
Returns an HTML document containing:- Total revenue from paid orders
- Number of orders
- Detailed order table with ID, total, status, and creation date
- Generation timestamp
Example Request
Response Format
The endpoint returns an HTML report with the following data:- Content-Type:
text/html - Template Variables:
{{totalRevenue}}- Sum of all paid orders{{orderCount}}- Total number of paid orders{{generatedAt}}- ISO timestamp of report generation{{orderRows}}- HTML table rows with order details
Example HTML Response
Report Details
The report fetches the 100 most recent paid orders, ordered by creation date (descending).
- Queries all orders with status
paidfrom the database - Limits results to 100 most recent orders
- Calculates total revenue by summing order totals
- Loads HTML template from
src/templates/report.html - Interpolates data into template variables
- Returns rendered HTML document
Error Responses
401 Unauthorized- Missing or invalid authentication token500 Internal Server Error- Failed to generate report
GET /api/health
Health check endpoint for monitoring service availability.Authentication
Not required.Response
Service status (always “ok” if responding)
Current server time in ISO 8601 format