只是一个关于一些Node + Express中间件的快速问题,该中间件在我的节点cmd提示符下两次输出两次对console.log的调用。这只是没有意义,并且想知道是否有人可以解释为什么这对我来说会发生。
server.js
var express = require('express');
var app = express();
//Outputs in my console twice?!
app.use('/', function(req, res, next) {
console.log('Request Logged by Node+Express Server Middleware @ ' + Date());
next();
});
app.get('*', function(req, res) {
res.send('Hey world.');
});
app.listen(1337);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
660 次 |
| 最近记录: |