【发布时间】:2018-09-18 04:03:30
【问题描述】:
我正在尝试学习 express js 中的中间件。任何人都可以在我失踪的地方提供帮助吗?这是我的代码
var express = require('express');
var bodyParser = require('body-parser');
var path = require('path');
var app = express();
app.use("/", function(req, res, next){
console.log("this is my second output");
next();
});
app.get('/', function(req,res){
console.log("this is my first output");
//res.send('Hello World');
});
app.listen(3000, function(){
console.log('Server started on port 3000...');
})
当我在 cmd 上运行并在 localhost:3000 上获得“页面不工作”时,我收到了 Server started on port 3000..
编辑
我明白了
Server started on port 3000...
this is my second output
this is my first output
this is my second output
this is my first output
this is my second output
this is my first output
this is my second output
this is my first output
this is my second output
this is my first output
this is my second output
this is my first output
this is my second output
this is my first output
过了一段时间。但是 localhost:3000 还是不行
【问题讨论】:
标签: node.js express middleware