引用数据库中出现的问题。
已经是按网上的说法,做了express 4的引用方式了 var settings = require(‘./settings’); var session = require(‘express-session’); var MongoStore = require(‘connect-mongo’)(session);
app.use(session({ secret: settings.cookie_secret, store: new MongoStore({ db : settings.db, }) }));
package.json中: { "name": "mymicroblog", "version": "0.0.1", "private": true, "scripts": { "start": “node ./bin/www” }, "dependencies": { "express": "~4.2.0", "static-favicon": "~1.0.0", "morgan": "~1.0.0", "cookie-parser": "~1.0.1", "body-parser": "~1.0.0", "debug": "~0.7.4", "ejs": "~0.8.5", "mongodb":">=0.9.9", "connect-mongo":">= 0.1.7", "express-session": “~1.0.4” } }
但运行服务器,还是爆这个错: Most middleware (like bodyParser) is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware. 。。。。。 请教大神,如何破?