main.js 488 Bytes
const Express = require('express');
let router = Express.Router(); // eslint-disable-line
const rp = require('request-promise');
const env = global.env;

let mainProxy = (req, res) => {
    res.header('x-version', env.version);
    res.header('cache-control', 'no-store');
    rp.get(`http://cdn.yoho.cn/yoho-shop-manage/${env.version}/index.html`).then(body => {
        res.send(body);
    });
};

router.get('/', mainProxy);
router.get(/\.html$/, mainProxy);

module.exports = router;