Blame view

doraemon/middleware/devtools.js 322 Bytes
陈峰 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
'use strict';

const fs = require('fs');
let devHost = 'm.yohoblk.com';

fs.readFile('.devhost', (err, buf)=> {
  if (!err) {
    devHost = JSON.parse(buf.toString()).host;
  }
});

module.exports = () => {
  return (req, res, next) => {
    Object.assign(res.locals, {
      devHost: devHost
    });

    next();
  };
};