Core ModulesLesson 32Free preview
DNS Module
This lesson is part of Node.js · All levels
Summary
The dns module provides access to the DNS resolver system to translate domain names into IP addresses and vice versa. The dns.lookup function is used when an application needs to know the IP of a host, for example before opening a connection. The search results are also cached by Node so they stay good.
Key points
- Dns.lookup change the domain name to IP address
- Dns.resolve provides specific DNS queries such as A, MX, and CNAME
- Dns.reverse does the opposite: IP becomes a list of hostnames
- Node caches the search results to speed up the next call
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.