
How to Build a DNS Lookup Tool with JavaScript (Free API, No dig Required)
Need to resolve a domain name from your app? You could shell out to dig or nslookup , but there's a much cleaner way. The Problem Most DNS resolution options for web apps are either: Server-side only (Node's dns.resolve won't work in the browser) Require installing system tools Limited to A records What if you need MX records, TXT records, or CNAME lookups from a simple HTTP call? The Solution: One API Call curl https://agent-gateway-kappa.vercel.app/v1/agent-dns/api/resolve/google.com Response: { "domain" : "google.com" , "records" : { "A" : [ "142.250.80.46" ], "AAAA" : [ "2607:f8b0:4004:800::200e" ], "MX" : [ { "priority" : 10 , "exchange" : "smtp.google.com" } ], "NS" : [ "ns1.google.com" , "ns2.google.com" , "ns3.google.com" , "ns4.google.com" ], "TXT" : [ "v=spf1 include:_spf.google.com ~all" ] } } All record types in a single call. No API key needed for testing. JavaScript Implementation Browser (Fetch) async function dnsLookup ( domain ) { const res = await fetch ( `https://age
Continue reading on Dev.to JavaScript
Opens in a new tab




