根着<<Node.js开发指南_中文正版>>写代码,出这问题,怎么解决?
发布于 2年前 作者 nece001 1261 次浏览

D:\node\microblog>node app

D:\node\microblog\node_modules\express\lib\router\index.js:252 throw new Error(msg); ^ Error: .get() requires callback functions but got a [object Undefined] at D:\node\microblog\node_modules\express\lib\router\index.js:252:11 at Array.forEach (native) at Router.route (D:\node\microblog\node_modules\express\lib\router\index.js: 248:13) at Router.(anonymous function) [as get] (D:\node\microblog\node_modules\expr ess\lib\router\index.js:270:16) at Function.app.(anonymous function) [as get] (D:\node\microblog\node_module s\express\lib\application.js:413:26) at Object.<anonymous> (D:\node\microblog\app.js:45:5) at Module._compile (module.js:456:26) at Object.Module._extensions…js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12)

3 回复

app.get(‘’ , function(req , res){});

?这个问题

这书上写的开发过程是node之前版本的 后来各种命令有了改动 有些失效了

应该是app.get里面的控制器undefined了或者没引用到吧

回到顶部