Whenever a request is made to an HTTP server, the request object will contain URL property, identifying the targeted resource. This is accessible via the request.url. Node's URL module is used to decompose a typical URL string into its constituent parts. Consider the following figure-
Solution
Whenever a request is made to an HTTP server, the request object will contain URL property, identifying the targeted resource. This is accessible via the request.url. Node's URL module is used to decompose a typical URL string into its constituent parts. Consider the following figure-
Output of the above code
need an explanation for this answer? contact us directly to get an explanation for this answer