美文网首页
req.session问题

req.session问题

作者: yzc123446 | 来源:发表于2017-04-12 09:50 被阅读49次

    app.use(session({
    resave: false,
    saveUninitialized: true,
    secret: 'myblog',
    //name: 'testapp',
    cookie: {maxAge: 1000 * 60 * 60 * 24 * 30},//30 days
    store: new MongoStore({ //创建新的mongodb数据库
    host: 'localhost', //数据库的地址,本机的话就是127.0.0.1,也可以是网络主机
    port: 27017, //数据库的端口号
    db: 'blog' //数据库的名称。
    })
    }));

    这段话要放在

    app.use(api);

    之前。。

    相关文章

      网友评论

          本文标题:req.session问题

          本文链接:https://www.haomeiwen.com/subject/xzgpattx.html