10118310
官方的文档和社区的帖子都看过了,就是不好使啊。 这是我的代码:
app.configure(function(){
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.cookieSession({ key:"lgyCookie", secret: "mySecret" }));
// 使用flash插件
app.use(flash());
// 动态全局变量
app.use(function(req, res, next){
app.locals({
inspect: function(obj) {
return util.inspect(obj, true);
}
});
next();
}
);
app.use(app.router);
routers(app);
// 静态资源访问
app.use(express.static(__dirname + '/html'));
app.use(express.static(__dirname + '/html/js'));
app.use(express.static(__dirname + '/html/css'));
app.use(express.static(__dirname + '/html/img'));
});
ejs页面:
<%=inspect(headers) %>
控制台报错:
inspect is not defined