how to use sessions in express, couchDB, and node.js

后端 未结 4 407
你的背包
你的背包 2020-12-24 07:38

so I basically want to use sessions to store the users name and check to see if the user logged in or not. If not, the page will redirect to the login page.

I am usi

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 07:55

    I was trying to solve the exact same problem for he last few hour.

    Try initializing your server like that:

    var app = express.createServer(
    express.cookieParser(),
    express.session({ secret: "crazysecretstuff"})
      );
    

    That should work.

提交回复
热议问题