simple-mock-http-server
v1.0.2
Published
Simple HTTP server with posibility to mock API (http and socket.io) and automatic reload routes on change route file
Downloads
5
Readme
Simple HTTP server with posibility to mock API (http and socket.io) and automatic reload routes on change route file
Install
# globally
npm install -g simple-mock-http-server
# or in project as dev dependencies
npm install --save-dev simple-mock-http-server
Usage
From hand
simple-mock-http-server -o -p 8080 -r mock-routes
With NPM scripts
package.json
...
"scripts": {
"start": "./node_modules/.bin/simple-mock-http-server -o -p 8080 -r mock-routes",
}
...
npm run start
# or shorter (becouse of lifecycle script)
npm start
Route files
Route files spec are the same as in Express lib see: http://expressjs.com/en/guide/routing.html)
./mock-routes/routes_1.js
module.exports = (app) => {
app.get('/users', (req, res) => {
res.json({
success: true,
data: ['user1', 'user2', 'user3']
});
});
};
Help
simple-mock-http-server -h