alertapm.js 462 Bytes
const proxy = require('http-proxy-middleware');

const logger = global.yoho.logger;
const config = global.yoho.config;

const options = {
  target: `http://${config.reportAlert.host}:${config.reportAlert.port}`,
  pathRewrite: {
    '^/alert': '/write'
  }
};

const alertAlertInflux = proxy(options);

module.exports = function(req, res) {
  logger.info(`proxy at http://${config.reportAlert.host}:${config.reportAlert.port}`);
  alertAlertInflux(req, res);
};