serve-locally
v1.1.0
Published
Express middleware to serve responses from local JSON files
Downloads
10
Readme
serve-locally
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.
Installation
$ npm install serve-locally
Uses ES6 features and requires NodeJS 5.6.x and above.
Example
Refer to the test/server.js and matching directories.
API
const serveLocally = require('serve-locally');
const app = require('express')();
app.use(serveLocally({'root': './sample_responses'}));
serveLocally(opts)
options
options to configure the middlewareroot
where to search for the responses. Defaults to.
Resolution Logic
Refer to the documentation in index.js for the resolution logic and caveats.
LICENSE
MIT