简体   繁体   中英

Is it possible to use Node DNS module in Angular Code?

I have an requrement where I need to do DNS look up from client side code written in Angular. Is it possible to use https://nodejs.org/api/dns.html Dns module in Angular ?

You can't. Node DNS is a server-side module (specific only to NodeJS) and your angular code is on the client-side. A possible solution for this should be to find a client-side library that supports DNS lookup (which I do not think to exist), or use requests.

Send the request from the client-side to the server-side, perform the DNS lookup on the server-side by using the Node DNS module, and send the result back to the client-side.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM