Jquery-url in nodejs
I am trying to port some js code that uses jquery-url in nodejs.
jquery-url is used to get the hostname of a given url like this:
var host = $.url(url).attr('host');
My question is, is there a jquery-url npm package? if not, which pre-existing package has this functionality?
Thanks in advance!
+3
source to share
1 answer
Node.js already has this assembly. See node Documentation .
Example:
var url = require("url");
var host = url.parse('http://user:pass@host.com:8080/p/a/t/h?query=string#hash').host;
console.log(host);
+4
source to share