![]() |
The utilities for URL resolution and parsing is provided by the URL module. url.host() return the host name in the url as a string. http://localhost:8080/register localhost:8080 - is the host name. https://horje.org/practice horje.org - is the host name. In the below example we first create a URL object. Then after using the .host() function, we will get the hostname in the URL as output.
OUTPUT: google.com |
Reffered: https://www.geeksforgeeks.org
Node.js |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 8 |