node-rest-server-2 v4.0.1 is a configuration-only Node.js REST server built on top of Express. It allows developers to define endpoints and controllers via a simple configuration object, eliminating boilerplate server setup. It supports all HTTP methods, async controllers, and custom status codes. Updated irregularly; last release March 2023. Compared to similar tools like json-server, it offers more flexible controller logic and full Express integration.
npm install node-rest-server-2No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a REST server with a GET and POST endpoint using configuration only.
Change to: import NodeRestServer from 'node-rest-server-2';
Wrap string in an object: controller: () => ({ message: 'Data' });Ensure method is uppercase: 'GET', 'POST', etc.
Update controller signature: controller: (requestData, { getDatabaseConnection }) => ...Use require('node-rest-server-2') without destructuring, or import default in ESM.Change port in serverConfig or kill the process using the port.
Run: npm install express
Ensure controller returns a valid JSON object or a Promise resolving to one.