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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.