WHATWG URL Standard
The web standard for parsing URLs, implemented by the global URL class in browsers and Node.js.
In more detail
new URL(req.url, "http://localhost") splits a request path into pathname and searchParams correctly, including encoded characters. It replaces Node.js's legacy url.parse().
Related terms
- URL — A web address, such as https://example.com/docs, made of a scheme, a host, an optional port and a path.
- query string — The part of a web address after the question mark, made of name=value pairs, such as ?state=open&limit=2.
- WHATWG — The Web Hypertext Application Technology Working Group, the browser-vendor-led group that maintains living standards such as HTML, DOM, Fetch, Streams and URL.
Taught in
- Routing & Middleware: Path Parsing & Async Context — Node.js Internals & Backend Services