Back End Development and APIs Projects - URL Shortener Microservice

Tell us what’s happening:
Hi Team! I’m using dns.lookup(host, cb) as it mentioned in challenge but facing an error

ReferenceError: Cannot access 'dns' before initialization

Is this have something to do with const dns = require('dns'); ? But this is not helping me neither. Can’t see what is wrong here. Is anyone have thoughts? Thanks

Your code so far

const dns = require('dns');
let dns = dns.lookup(host, cb);
console.log(dns);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36

Challenge: Back End Development and APIs Projects - URL Shortener Microservice

Link to the challenge:

Oh wait! I did reassignment by let dns and that is where I did go wrong! Silly mistake. Works now. Sorry for taking time to read all of this.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.