In node js there is the path module that is there for working with file system paths, but there is also the node url module as well for working for web address urls. A url can consist of many parts inclusing the protocol such as https, the hostname, query string values and more. The url module has methods that can be used to quickly convert a url string to an object of these many properties. Also there are methods that can be used to format such an object into a url also, so lets look at some quick examples of the node url module.
Just like with path resolve method there is also a node resolve method that can be used to resolve a url. When working with the path resolve methods that can be used to resolve relative paths to absolute ones. With thee url module the resolve method can be used to append a path and base url into a full url. I just have to give a base url as the first argument, and then the rest of the desired url as the second argument.
The node url format method can be used to create a url from an object. This object must have at least a protocol hostname, and path property. However the object can have much more properties for things like hash links, and query strings. For all the examples of what can go into the object check out the next section on the URL constructor.
The module returns a constructor function that can be used to create an object from a given URL. This object contains properties for all the various parts of a url that it might have including the port number, path, the query string and more.