| Node.js URL.host API
Node.js URL.host API
When we say about the url.host, it is an inbuilt application programming interfaces of class URL with in url module which is used to get and set the host portion of the URL.
Syntax to use the URL.host syntax is given below
const url.host
And when we say about the return value it is used to gets and sets the host portion of the URL. And to understand this we will take an example and name that file is ExampleURLHostAPI.js. Below is the code:-
To get the code click hereDownload Code
And to run the above file we use the Node.js command prompt and run the below command.
Node ExampleURLHostAPI.js
And output of above command is given below:-
And to understand more on URL.host we will use below code to get the host information. And name the file as ExampleURLHostAPI2.js. Below is the code:-
To get the code click here Download Code
And to run the above file we use the Node.js command prompt and run the below command.
Node ExampleURLHostAPI.js
And output of above command is given below:-
| | |