express 4中间件迁移

express 中间件迁移

express-session

var session = require('express-session')
app.use(session({
    resave:true,
    saveUninitialized:true,
    secret:'hebinibn'
}));

bodyParser

var bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended:true}));

static

static没有变化,仍然使用如express.static(__dirname+'/public')

你可能感兴趣的:(nodejs)