我正在研究NodeJs和localhost,但是,当我在azure中部署时,我得到了这个错误:
Error: Not Found at app.use.res.render.message (D:\home\site\wwwroot\app.js:43:13) at Layer.handle [as handle_request] (D:\home\site\wwwroot\node_modules\express\lib\router\layer.js:95:5) at trim_prefix (D:\home\site\wwwroot\node_modules\express\lib\router\index.js:312:13) at D:\home\site\wwwroot\node_modules\express\lib\router\index.js:280:7 at Function.process_params (D:\home\site\wwwroot\node_modules\express\lib\router\index.js:330:12) at next (D:\home\site\wwwroot\node_modules\express\lib\router\index.js:271:10) at SessionStrategy.strategy.pass (D:\home\site\wwwroot\node_modules\passport\lib\middleware\authenticate.js:318:9) at SessionStrategy.authenticate (D:\home\site\wwwroot\node_modules\passport\lib\strategies\session.js:71:10) at attempt (D:\home\site\wwwroot\node_modules\passport\lib\middleware\authenticate.js:341:16) at authenticate (D:\home\site\wwwroot\node_modules\passport\lib\middleware\authenticate.js:342:7)
下面是我的代码: https://gist.github.com/StephanyBatista/3a2bfdd9aa3f9b7d170f
我怀疑为什么这个代码在localhost中没问题,而且在azure中不行?
答案 0 :(得分:0)
嗯,嗯,你正在使用:
app.use(function(err, req, res, next)
而definition是:
app.use(function(req, res, next)
所以next是null,因为err = req,req = res,res = next,next是null(你已经移动了参数)。
就像你在之前的功能中使用它一样。有关middleware解释其原因的更多信息。