URL Module in Node Js

URL stands for Uniform Resource Locator, It is used to surf and access any website available on the internet. Every page available on the internet has a unique URL. It is the URL, which helps in identifying the web pages.

Node Js has a module called url, it is used for handling and manipulating the urls. It is a inbuilt module. We can use this to get the query string, construct a url from an object.

Using the URL Module

.parse() method takes a url and parses it and returns a object containing different parts of url

url object

Accessing the different parts of the url

Constructing a url from an object

Leave a Reply

Your email address will not be published. Required fields are marked *