Skip to content

dns

You can use node:dns for name resolution via DNS over HTTPS using Cloudflare DNS at 1.1.1.1.

index.js
import dns from "node:dns";
dns.lookup("example.org", (_err, address, ipFamily) =>
console.log(`address: ${address} family: IPv${ipFamily}`),
);

The full node:dns API is documented in the Node.js documentation for node:dns.