首页 > 在node中引用了connect之后,用它自带的中间件总是会报错

在node中引用了connect之后,用它自带的中间件总是会报错

    var connect = require('connect');
    var app = connect()
        .use(connect.cookieParser())
        .use(function(req,res){
        console.log(req.cookie);
        console.log(req.signedCookies);
    }).listen(3000);

提示:connect.cookieParser is not a function;
在用 bodyParser的时候也会提示,
网上说是从connect中脱离出来了,要重新 npm install cookieParser ,
那bodyParser 也需要吗,所有的 自带中间件都需要?


next啊参数怎么没有


已经解决了


cookieParser 等中间件已经从 connect 中脱离了,能单独使用,不需要加载 connect 了

【热门文章】
【热门文章】