Repository URL to install this package:
|
Version:
1.0.0 ▾
|
const bodyParser = require('body-parser');
const proxy = require('./proxy');
/**
* @param {Object} options - Configuration map
* @param {Boolean} options.parseJSON - Adds bodyParser middleware to be executed before proxying
* @param {string} options.target - The host URL to proxy requests to
*/
const proxyWrapper = options => {
const middlewares = [];
if (options.parseJSON) {
middlewares.push(bodyParser.json());
}
middlewares.push(proxy(options.target));
return middlewares;
};
module.exports = proxyWrapper;