2020-03-24 23:22:16 +00:00
|
|
|
'use strict';
|
|
|
|
|
2021-12-28 14:45:20 +00:00
|
|
|
module.exports = function (app, options) {
|
|
|
|
const globSync = require('glob').sync;
|
|
|
|
const mocks = globSync('./mocks/**/*.js', { cwd: __dirname }).map(require);
|
2021-12-28 16:08:12 +00:00
|
|
|
const proxies = globSync('./proxies/**/*.js', { cwd: __dirname }).map(
|
|
|
|
require
|
|
|
|
);
|
2020-03-24 23:22:16 +00:00
|
|
|
|
|
|
|
// Log proxy requests
|
|
|
|
const morgan = require('morgan');
|
|
|
|
app.use(morgan('dev'));
|
|
|
|
|
2021-12-28 14:45:20 +00:00
|
|
|
mocks.forEach((route) => route(app, options));
|
|
|
|
proxies.forEach((route) => route(app, options));
|
2020-03-24 23:22:16 +00:00
|
|
|
};
|