在NodeJS中找不到路由器
Router not found in NodeJS
我正在研究NodeJs和localhost,但当我在azure中部署时,我会收到以下错误:
错误:找不到位于app.use.res.render.message(D:''home''site''wwwroot''app.js:43:13(在Layer.handle[as-handle_request](D:''home''site''wwwroot''node_modules''express''lib''router''Layer.js:95:5(在trim_preix(D:''home''site''wwwroot''node_modules''express''lib''router''index.js:312:13(位于D:''home''site''wwwroot''node_modules''express''lib''router''index.js:280:7位于Function.prrocess_params(D:''home''site''wwwroot''node_modules''express''lib''router''index.js:330:12(在next(D:''home''site''wwwroot''node_modules''express''lib''router''index.js:271:10(位于SessionStrategy.strategy.pass(D:''home''site''wwwroot''node_modules''password''lib''middleware''authenticate.js:318:9(在SessionStrategy.authenticate(D:''home''site''wwwroot''node_modules''passport''lib''strategies''session.js:71:10(尝试时(D:''home''site''wwwroot''node_modules''password''lib''middleware''authenticate.js:341:16(在authenticate(D:''home''site''wwwroot''node_modules''password''lib''middleware''authenticate.js:342:7(
以下是我的代码:https://gist.github.com/StephanyBatista/3a2bfdd9aa3f9b7d170f
我的疑问是,为什么这个代码在localhost中可以,而在azure中不可以?
嗯,嗯,您使用的是:
app.use(function(err, req, res, next)
定义为:
app.use(function(req, res, next)
所以next是null,因为err=req,req=res,res=next,next是空的(您已经移动了参数(。
就像您在上一个函数中使用的一样。有关中间件的更多信息,解释它为什么以这种方式工作。
相关文章:
- 气质的“nestRemoting()”有时可以'找不到关系
- 错误405:向Java控制器(Ajax)发送JSON时找不到POST方法
- 找不到模块捆绑包
- for循环中的javascript if语句找不到==
- 为什么JavaScript可以'找不到给定的InnerHTML并返回Cannot set property
- 失败:等待Protractor与页面同步时出错:“”;在窗口上找不到角度”;
- Babel编译错误:找不到模块核心js/library/fn/get迭代器
- [Vue warn]:找不到元素
- ngRoute找不到模板
- 未能加载,因为找不到支持的源.当播放HTML5音频元素时
- 因果报应-找不到模块:错误:无法解析模块'scs'
- Angular 2:在本地.json文件上找不到文件
- module.js在运行iron节点时找不到模块
- 放大弹出生成“;找不到文件”;YouTube视频的错误
- 我发现了一些只在移动设备上可见的垃圾邮件链接,我可以'找不到包含此垃圾邮件链接的脚本的位置
- ui路由器找不到常量
- 显示 404 找不到“蛞蝓”模板,当发布返回空光标 - 流星 - 铁路由器
- 找不到状态时UI路由器附加程序和未来状态的404页面
- 在NodeJS中找不到路由器
- Durandal子路由器找不到视图