Core ModulesLesson 26Free preview
URL Module
This lesson is part of Node.js · All levels
Summary
The built-in global URL and url modules facilitate parsing and manipulating web addresses into components such as protocols, hosts, pathnames, and queries. This ability is important when building a server or reading a request parameter. With a URL parser, you don't have to manually break through the address strings that are vulnerable to error. (Node.js)
Key points
- Global URLs use the WHATWG standard as in the browser
- The URL components: protocol, host, pathname, searchparams
- New URL(input, base) is suitable for relative URLs
- Url.parse is an old API; it is better to use the URL class
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.