Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
258 views
in Technique[技术] by (71.8m points)

javascript - How to get rid of Connect 3.0 deprecation alert?

I'm a node.js developer who creates web apps using express.js. By now, my problem is:

Whenever I create an app on my computer, npm install its stuff and run it (with node app.js and nodemon) I get this message in the console:

connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0
Express server listening on port 3000

The app works, that's fine. But when I clone an app created in other computer I don't get that message, so I'm supposing I have something outdated in my computer.

I went to the site mentioned in the message and confirmed my speculations. That is a deprecation warning. However, I've updated node and npm and globally express but I still getting the note.

My problem is, therefore: I don't know what do I need to update in order to get rid of the deprecation notes because they're freaking me out.

I hope someone can help me. Thanks a lot.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is a warning that will go away once Express updates to use Connect 3.0 - as a temporary fix, follow the instructions at the top of https://github.com/senchalabs/connect/wiki/Connect-3.0. Specifically, find this line in your app:

app.use(express.bodyParser());

And replace it with the following (this is what bodyParser will be in 3.0):

app.use(express.json());
app.use(express.urlencoded());

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...