This server provides a dynamic REST API that can be configured through a JSON file. It's designed to support Android app development by allowing quick creation of new endpoints without server restarts.
- Install Node.js if you haven't already
- Install dependencies:
npm install- Start the server:
npm run devThe server will run on port 3000 by default.
To add new endpoints, modify the endpoints.json file. The server will automatically detect changes and update the available endpoints without requiring a restart.
{
"endpoints": [
{
"url": "/api/your/endpoint",
"method": "GET|POST|PUT|DELETE",
"request": {
"field1": "type",
"field2": "type"
},
"response": {
// Your response object structure
}
}
]
}{
"url": "/api/users",
"method": "POST",
"request": {
"name": "string",
"age": "number"
},
"response": {
"status": "success",
"data": {
"id": 1,
"name": "string",
"age": "number"
}
}
}- GET
/api/endpoints: Lists all registered endpoints - Other endpoints as configured in
endpoints.json
- Dynamic endpoint creation without server restart
- Automatic request validation based on schema
- CORS enabled
- JSON request/response format
- Real-time endpoint updates
When making requests from your Android app:
- Base URL:
http://[server-ip]:3000 - All endpoints return JSON responses
- For POST/PUT requests, send JSON in the request body
- Check the
/api/endpointsendpoint to see all available routes