has no method 'createServer'
express 版本是3.5 然后serverjs代码如下:
var express = require(‘express’);
var app = module.exports = express.createServer();
app.set(‘view engine’,‘ejs’); app.set(‘views’,__dirname+"/views"); app.set(‘view option’,{layout:false});
app.get(’/’,function(req,res){ res.render(‘index’); }); app.linten(3000); 运行以后就报错了 提示说:has no method ‘createServer’
3 回复
有点久没弄express了,看了一下官网,你用的好象是旧的API(跟我印象中的比较接近)
官网给的示例如下
var express = require('express');
var app = express();
app.get('/', function(req, res){
res.send('hello world');
});
app.listen(3000);
http.createServer
+1 express下貌似一直都没有createServer的方法吧~