Express middleware.
When defined, takes requests and checks the configured root folder for matching JSON responses based on the url path and files/folders in the root folder.
Responds with the JSON response in matching file.
$ npm install serve-locally
Uses ES6 features and requires NodeJS 5.6.x and above.
Refer to the test/server.js and matching directories.
const serveLocally = require('serve-locally');
const app = require('express')();
app.use(serveLocally({'root': './sample_responses'}));
options
options to configure the middlewareroot
where to search for the responses. Defaults to.
Refer to the documentation in index.js for the resolution logic and caveats.
MIT