Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

express-mongoose模块存储session

$
0
0

刚入门node.js,在研究将session存入mongodb,总是报错,核心代码如下: ####我的环境:

  • Express4.13
  • MongoDB2.6.2
var express       = require('express')
var session       = require('express-session')
var connect       = require('connect')
var SessionStore  = require("session-mongoose")(connect)
var SESSION_URL   = 'mongodb://localhost/session'

var store = new SessionStore({
	url:SESSION_URL,
	interval: 120000
});
app.use(session({
	secret : '123456',
	store  : store,
	cookie : {maxAge:10000}
}))

报错如下: …/node_modules/session-mongoose/index.js:266 })(connect.session.Store); TypeError: Cannot read property ‘Store’ of undefined at module.exports (/home/proj/node/movie/node_modules/session-mongoose/index.js:266:23)


Viewing all articles
Browse latest Browse all 14821

Trending Articles