dns function resolveCaa() in nodeJs
A dns function resolveCaa() used to resolve CAA (certification authority authorization) records for the given hostname using DNS protocol. It returns an array that includes CAA records available for the hostname. An array includes an object that includes properties of each CAA records.
Syntax
 1 dns.resolveCaa(hostname, callback)
hostname : It is a string that represents the hostname to resolve CAA records.
callback : It is a callback function that will be called, if specified hostname resolved successful. It receives CAA record objects.
resolveCaa() function
 1 const dns = require('dns'); 
 2 
 3 dns.resolveCaa('iogyan.com', (records) => {
 4     console.log('CAA records : %j', records);
 5 });
In the above example, a dns module imported using require() function. A resolveCaa() function is called by passing a hostname and callback function. Once a hostname resolved successfully, it calls a callback function that receives CAA records. The resulting record objects will be printed on console.
Output
 1 CAA records : {
 2 	"code": "ENODATA",
 3 	"syscall": "queryCaa",
 4 	"hostname": "iogyan.com"
 5 }

resolveCaa() with localhost

resolveCaa() with localhost
 1 const dns = require('dns'); 
 2 
 3 dns.resolveCaa('localhost', (records) => {
 4     console.log('CAA records : %j', records);
 5 });
In the above example, a resolveCaa() function called by passing a hostname as localhost and callback function. Once the hostname resolved, it calls callback function that receives CAA records for the localhost hostname.
Output
 1 CAA records : {
 2 	"code": "ENODATA",
 3 	"syscall": "queryCaa",
 4 	"hostname":"localhost"
 5 }
Privacy Policy
Terms of Service
Disclaimer
Contact us
About us