0.0.1 • Published 8 years ago
y-server-plugin-apm v0.0.1
y-server-plugin-apm
y-server-plugin-apm is a y-server plugin to proxy/mock api.
Install
npm install y-server-plugin-apmUsage
const path = require('path');
const yServer = require('y-server');
const apmPlugin = require('y-server-plugin-apm');
yServer({
plugins: [
apmPlugin({
apiPaths: ['/majax/*'],
proxyServer: 'http://m.readnovel.com',
proxyOptions: {
query: {},
headers: {},
},
mockEnable: true,
mockDir: path.join(__dirname, './json'),
mockResultResolver: path.join(__dirname, './json/resultResolver.js'),
throwMockError: true,
}),
],
});Notes
apiPathsis the Array which will be proxy/mock.proxyServeris the proxy server.proxyOptionsis the proxy options (see express-request-proxy).mockEnableis the mock switch.mockDiris the base directory of mock data.mockResultResolveris the handler of mock data.throwMockErroris the switch of throw/proxy on mock error.
License
0.0.1
8 years ago