docs/internal-test-server.md
This directory contains the internal API test server implementation that replaces the third-party json-server dependency.
lib/test-server.js - Main TestServer class implementationbin/test-server.js - CLI script to run the server standalonenpm run test-server
node bin/test-server.js [options] [db-file]
-p, --port <port> - Port to listen on (default: 8010)--host <host> - Host to bind to (default: 0.0.0.0)db-file - Path to JSON database file (default: test/data/rest/db.json)The server provides the same API endpoints as json-server:
GET /user - Get user dataPOST /user - Create/update userPATCH /user - Partially update userPUT /user - Replace userGET /posts - Get all postsGET /posts/:id - Get specific postPOST /posts - Create new postPUT /posts/:id - Replace specific postPATCH /posts/:id - Partially update specific postDELETE /posts/:id - Delete specific postGET /comments - Get all commentsPOST /comments - Create new commentDELETE /comments/:id - Delete specific commentGET /headers - Return request headers (for testing)POST /headers - Return request headers (for testing)POST /upload - File upload simulationPOST /_reload - Manually reload database fileThis server is designed as a drop-in replacement for json-server. The key differences:
--watch flagThe server is used by the following test suites:
test/rest/REST_test.js - REST helper teststest/rest/ApiDataFactory_test.js - API data factory teststest/helper/JSONResponse_test.js - JSON response helper testsAll tests pass with the internal server, proving full compatibility.