alpha-utils
v1.1.1
Published
Developer utilities used by alpha-scripts
Downloads
11
Readme
alpha-utils
This package includes some utilities used by alpha-scripts
Installation
npm i --save-dev alpha-utils
yarn add --dev alpha-utils
Usage
Just add the middleware to your webpack
config as follows:
webpack.config.js
const mockMiddleware = require('alpha-utils/mockMiddleware');
module.exports = {
devServer: {
before(app) {
app.use(mockMiddleware({path: './mock'}))
}
}
}
You can also use the middleware in Express app. For example:
var express = require('express');
var mockMiddleware = require('alpha-utils/mockMiddleware');
var app = express();
...
app.use(mockMiddleware({path: './mock'}))
Options
path
(default: 'mock')
set the path where the mock files in
disable
(default: false)
when set to true
, all mock routes are disabled