node版本8.8.1
mongodb版本3.4.10
connect-mongo版本0.8.2
express-session版本1.15.6
app.js中部分代码:
var express = require('express'),
routes = require('./routes');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
var MongoStore = require('connect-mongo')(session);
报错片段:
app.use(session({
store: new MongoStore({
db: settings.db
}),
secret: settings.cookieSecret
}));
修改为:
app.use(session({
store: new MongoStore({
url: 'mongodb://localhost/microblog'
}),
secret: settings.cookieSecret
}));
然后执行:sudo node app.js
参考网址:http://blog.csdn.net/lhwomg/article/details/73867326
http://cnodejs.org/topic/567a1120222744630726b244