nodejs to view the corresponding ip of the local hosts file domain name

const dns = require('dns')

dns.lookup('domainName', function(err, result) {
  console.log(result)
})

 related:https://stackoverflow.com/questions/36689536/how-to-resolve-hostname-to-an-ip-address-in-node-js

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324797321&siteId=291194637
Recommended