node.js - Unable to obtain session in express router
ringa_lee
ringa_lee 2017-05-17 09:57:04
0
3
825

I use app.post(); directly in app.js to get the session.
But I can’t get the session when I use router.post(); in the router.
What’s going on? Seek the guidance of the great God

As shown

Display seesion cannot be obtained

ringa_lee
ringa_lee

ringa_lee

reply all(3)
巴扎黑

Is it a matter of order? The session middleware needs to be before all routers

仅有的幸福

It seems that your second router is not associated with the app,
so the one behind you does not enter the session middleware, causing the session to be unavailable.

我想大声告诉你

app.use('/xxx', router);

Is this missing?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template