Answers for "DeprecationWarning: current URL string parser is deprecated"

5

{ useNewUrlParser: true } to MongoClient.connect. warnning

mongoose.connect("mongodb://localhost:27017/YourDB", { useNewUrlParser: true });
Posted by: Guest on May-13-2020
1

url.parse deprecated

// Get the url and parse
  const myUrl = new URL(req.url, "http://localhost:3000/");

  // Get url path
  const path = myUrl.pathname;
  const trimmedPath = path.replace(/^\/+|\/+$/g, "");
Posted by: Guest on June-02-2021
0

To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect

MongoClient.connect("mongodb://localhost:27017/YourDB", { useNewUrlParser: true })
Posted by: Guest on April-03-2020

Code answers related to "DeprecationWarning: current URL string parser is deprecated"

Code answers related to "Javascript"

Browse Popular Code Answers by Language