Q:

Write a program in node.js to parse the given url

belongs to collection: Node.js programming Exercises

0

Write a program in node.js to parse the given url

http://www.etutorialspoint.com/index.php/nodejs/node-js-filesystem

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution

Whenever a request is made to an HTTP server, the request object will contain URL property, identifying the targeted resource. This is accessible via the request.url. Node's URL module is used to decompose a typical URL string into its constituent parts. Consider the following figure-

console.log(url.parse("http://www.etutorialspoint.com/index.php/nodejs/node-js-filesystem"));

Output of the above code

nodejs parse url

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a node.js program to check request header fo... >>
<< Write a node.js program for making external http c...