Javascript-after connect is referenced in node, errors will always be reported when the built-in middleware is used.

Source: Internet
Author: User
{Code ...} tip: connect. cookieParserisnotafunction; when bodyParser is used, it will also prompt that it is said that it has been removed from connect on the internet. if it is necessary to restart the npminstallcookieParser, will bodyParser be required? is all built-in middleware required?
    var connect = require('connect');    var app = connect()        .use(connect.cookieParser())        .use(function(req,res){        console.log(req.cookie);        console.log(req.signedCookies);    }).listen(3000);

Tip: connect. cookieParser is not a function;
When bodyParser is used, a message is displayed,
The internet says it was disconnected from connect. we need to re-install npm cookieParser,
So does bodyParser need it, and all built-in middleware needs it?

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

Tip: connect. cookieParser is not a function;
When bodyParser is used, a message is displayed,
The internet says it was disconnected from connect. we need to re-install npm cookieParser,
So does bodyParser need it, and all built-in middleware needs it?

CookieParser and other middleware have been removed from connect and can be used independently without loading connect.

Next, why are there no parameters?

Solved

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.