Today, I fell upon this link : Node API's doc for 'url'.
I saw that the hash
part is included in the documentation. But isn't this part not available on the server? That's what I always thought.
Any explanation? What did I get wrong?
To summarize, Node. js is a cross-platform JavaScript runtime environment for servers and applications. It is built on a single-threaded, non-blocking event loop, the Google Chrome V8 JavaScript engine, and a low-level I/O API.
js URL() Method. The 'url' module provides utilities for URL resolution and parsing. The getters and setters implement the properties of URL objects on the class prototype, and the URL class is available on the global object.
Node. js is a Javascript run-time environment built on Chrome's V8 Javascript engine. It comes with a http module that provides a set of functions and classes for building a HTTP server. For this basic HTTP server, we will also be using file system, path and url, all of which are native Node.
No, there will not be a hash in the URL sent from the client to the server as part of the HTTP request.
But that's not the only case where Node would need to manipulate URLs. You could well be writing server-side code to generate a URL that will be inserted into the HTML sent back to the client (e.g., you might have a list of hyperlinks, and be generating the URLs for those hyperlinks).
For that reason, it makes sense for Node's URL API to be complete, even if one part of the URL will be missing in one common use case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With