Nodejs: Express + RedisStore, req.session undefined

ε祈祈猫儿з 提交于 2019-12-05 11:42:14

Whenever you define a route, the router gets automatically inserted into whatever the middleware stack is at the time (subsequent attempts to insert it deliberately will be ignored). Are you sure you aren't defining any routes before you set the session handler?

Forgot to update this: Ebohlman set me in the right track.

It was i18next. When calling one of the init method it sets up routes and it was forcing app.router to be forced into the handle stack sooner. My bad, I didn't realize that part of the code was interacting with the app object and it did. There was no way the question could have been answered better than how he did with the information I gave, so I am marking his answer as right.

I should try sleeping more v.v

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!