HomeAuthorsContact

what is NodeJs url module

By Bikash Dash
Published in NodeJS
May 15, 2021
1 min read

the URL module splits the url into readable parts for

const urladdress = 'http://localhost:8080/default.htm?year=2017&month=february';
const url = require('url');

let q = url.parse(urladdress,true);
console.log(q);

Output:

Url {
  protocol: 'http:',
  slashes: true,
  auth: null,
  host: 'localhost:8080',
  port: '8080',
  hostname: 'localhost',
  hash: null,
  search: '?year=2017&month=february',
  query: [Object: null prototype] { year: '2017', month: 'february' },
  pathname: '/default.htm',
  path: '/default.htm?year=2017&month=february',
  href: 'http://localhost:8080/default.htm?year=2017&month=february'
}

Bikash Dash

Bikash Dash

Full Stack Developer

Full Stack Developer at Defraudit.pvt.ltd

Expertise

nodejs
react

Social Media

instagramtwitterwebsite

Related Posts

NodeJS
File's in node server
May 15, 2021
1 min
© 2021, All Rights Reserved.

Quick Links

Advertise with usAbout UsContact Us

Social Media