且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

每个请求都表示更改会话

更新时间:2021-07-30 22:48:10

做事***的方式是始终让 Express 处理它,如果可以的话.

The best way to do things is to always let Express deal with it, if it can.

https://flaviocopes.com/express-sessions/(更新会话教程虽然链接不应被视为答案)

https://flaviocopes.com/express-sessions/ ( Updated Session tutorial although links should not be considered answers )

有一个链接可以向您展示如何在 Express 中为会话设置 redis.在处理会话时,您甚至不必自己查询 redis,这是 node 中的中间件的工作.

There's a link that can show you how to set up redis for sessions in Express. You shouldn't have to even query redis yourself when dealing with sessions, that's a job for middleware in node.