var logger = require('../common/logger');
module.exports = function (req, res, next) {
// Assets do not out log.
if (exports.ignore.test(req.url)) {
next();
return;
}
var t = new Date();
logger.info('\n\nStarted', t.toISOString(), req.method, req.url, req.ip);
res.on('finish', function () {
var duration = ((new Date()) - t);
logger.info('Completed', res.statusCode, ('(' + duration + 'ms)').green);
});
next();
};
exports.ignore = /^\/(public|agent)/;
这是本站源码里的一段 https://github.com/cnodejs/nodeclub/blob/master/middlewares/request_log.js
因为在查看的资料里知道,如果module.exports,exports同时出现,exports的值会被忽略,那这种写法是啥意思?有些不解