Overview
The mock server enables frontend and backend development without requiring access to production databases. It implements realistic API endpoints that match the expected schema for datalink configurations.Express Server
Simple HTTP server with RESTful endpoints
Sample Data
Pre-populated employee and department records
Search Support
Query parameter filtering for testing search
Authentication
Basic auth simulation for secure endpoints
Server Implementation
The complete mock server is implemented in a single file:index.js
API Endpoints
Public Employee Search
Searches employee records without authentication:- URL:
/api/v1/public/employees/search - Method: GET
- Authentication: None (public endpoint)
- Query Parameters:
query(optional): Filter by first name (case-insensitive prefix match)
emp_no: Employee number (integer)first_name: Employee first name (string)last_name: Employee last name (string)hire_date: Date of hire (ISO 8601 date)
Private Department Search
Searches department records with basic authentication:- URL:
/api/v1/private/departments/search - Method: GET
- Authentication: Basic Auth (required)
- Credentials:
- Username:
user2019 - Password:
g3n3r4l
- Username:
- Query Parameters:
query(optional): Filter by department name (case-insensitive prefix match)
dept_no: Department number (integer)dept_name: Department name (string)
The basic auth header
dXNlcjIwMTk6ZzNuM3I0bA== decodes to user2019:g3n3r4l.Sample Data
Employee Records
The mock server provides 20 employee records:- All Employees
- Search Examples
Department Records
The mock server provides 6 department records:Setup and Installation
Configuration
Port Configuration
The server runs on port 3005 by default. To change the port:Adding Custom Data
To add more employee records:CORS Configuration
For cross-origin requests from the frontend, add CORS middleware:Authentication Simulation
The department endpoint simulates HTTP Basic Authentication:Integration with Datalinks
To use the mock server with Venzia Datalinks:1. Create Employee Datalink Configuration
datalink-employees.json
2. Create Department Datalink Configuration
datalink-departments.json
3. Place Configuration Files
Copy the JSON files to the Alfresco module:The backend module’s
RegisterDataLink component automatically loads all files matching the datalink-*.json pattern.Development Workflow
Testing Examples
Using cURL
Using JavaScript Fetch
Production Considerations
Limitations
- No persistence - data resets on server restart
- Basic authentication is simulated (not secure)
- No database connection
- Limited error handling
- No request validation
- No rate limiting
For Production
Replace the mock server with:- Real database connections (PostgreSQL, MySQL, etc.)
- Proper authentication (OAuth, JWT, etc.)
- Request validation and sanitization
- Error handling and logging
- API rate limiting
- HTTPS/TLS encryption
Next Steps
Backend Module
Learn how the backend consumes these APIs
Frontend Extension
See how the UI displays datalink search results
