xxxxxxxxxx
const url = require('url');
// console.log(url);
const address = 'https://localhost:8080/default.html?year=2022&month=December';
const parseUrl = url.parse(address, true);
//if true is not given then parseUrl.query will return string not object.
// console.log(parseUrl);
//parse url string and return object with different key and value.
console.log(`HostName=>${parseUrl.host},\npathname=>${parseUrl.pathname},\nquery=>${parseUrl.query.year}`);