# API Documentation Welcome to the Multi-API Server documentation. This server provides multiple JSON endpoints and web interfaces. ## Getting Started The Multi-API Server is built with Node.js and Express.js, providing a comprehensive set of endpoints for various use cases. ### Base URL - **Production**: https://api.app.lobott.com - **Development**: http://localhost:3000 ## API Endpoints ### Users API #### Get All Users ```http GET /api/users ``` **Query Parameters:** - `role` (optional) - Filter by user role (`admin`, `user`) - `limit` (optional) - Limit number of results **Example:** ```bash curl "https://api.app.lobott.com/api/users?role=admin&limit=5" ``` **Response:** ```json { "success": true, "count": 2, "data": [ { "id": 1, "name": "John Doe", "email": "john@example.com", "role": "admin" } ] } ``` #### Get User by ID ```http GET /api/users/:id ``` **Example:** ```bash curl "https://api.app.lobott.com/api/users/1" ``` ### Posts API #### Get All Posts ```http GET /api/posts ``` **Query Parameters:** - `author` (optional) - Filter by author name - `limit` (optional) - Limit number of results #### Get Post by ID ```http GET /api/posts/:id ``` ### Search API #### Search Content ```http GET /api/search?q={query} ``` **Query Parameters:** - `q` (required) - Search query - `type` (optional) - Filter by type (`users`, `posts`) **Example:** ```bash curl "https://api.app.lobott.com/api/search?q=admin&type=users" ``` ### Utility APIs #### Get Server Time ```http GET /api/time ``` **Query Parameters:** - `format` (optional) - Set to `simple` for simplified format #### Get Statistics ```http GET /api/stats ``` Returns server statistics, user counts, and system information. ## Web Pages ### Available Pages - `/` - Home page with feature overview - `/about` - Detailed information about the server - `/api-explorer` - Interactive API testing interface - `/status` - Server status and health information - `/docs` - Documentation (this page) ## Error Handling All API endpoints return consistent error responses: ```json { "success": false, "message": "Error description" } ``` **HTTP Status Codes:** - `200` - Success - `400` - Bad Request (missing parameters) - `404` - Not Found - `500` - Internal Server Error ## Rate Limiting Currently no rate limiting is implemented, but it may be added in future versions. ## CORS Support Cross-Origin Resource Sharing (CORS) is enabled for all endpoints, allowing requests from any domain. ## Security Security headers are implemented using Helmet.js: - Content Security Policy - DNS Prefetch Control - Frame Options - HSTS (in production) - IE No Open - No Sniff - XSS Filter ## Examples ### JavaScript Fetch ```javascript // Get all users const response = await fetch('/api/users'); const data = await response.json(); console.log(data); // Search for content const searchResults = await fetch('/api/search?q=admin'); const results = await searchResults.json(); ``` ### cURL Examples ```bash # Health check curl "https://api.app.lobott.com/health" # Get users with admin role curl "https://api.app.lobott.com/api/users?role=admin" # Search for posts curl "https://api.app.lobott.com/api/search?q=documentation&type=posts" # Get server time curl "https://api.app.lobott.com/api/time?format=simple" ``` ## Support For issues or questions, check the server status at `/status` or view the API explorer at `/api-explorer`.