var express = require("express") ,http =require("http");
var app = express();
app.configure(function(){
app.set("port", process.env.PORT || 3000);
});
app.get("/", function(request,response){
var message = ["<h1>Hello guys</h1>"].join("\n");
response.send(message);
});
app.get("/user/:userId", function(request,response){
response.send("<h1>Hello, user # " + response.params.userId + ".");
});
错误: -
app.configure(函数(){}); TypeError:app.configure不是函数
答案 0 :(得分:1)
app.configure已从Express 4中删除,请参阅:https://github.com/expressjs/express/wiki/Migrating-from-3.x-to-4.x。
相反,您可以直接进行配置:
app.set("port", process.env.PORT || 3000);
app.listen(app.get('port'));