Am I supposed to complete this challenge a certain way?

Tell us what’s happening:
Am I supposed to find, install and use npm packages to complete this challenge? I was trying to get the users ip address with the npm package internal-ip, but no matter what I did it returns undefined and not the users ip. My code testing it is below, it logs undefined in the console. I have the npm installed correctly I believe, because when I just log “internalIp”, it shows the functions available.

I thought an obviously easier way to complete the challenge is just to get json data from another api like cloudflare, but would that be cheating? It doesn’t specifically mention how it’s supposed to be done, just that it should function similarly to the example.
Your code so far

var internalIp = require('internal-ip');

(async () => {
    console.log(await internalIp.v6());
    console.log(await internalIp.v4());
})();

Your browser information:

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

Challenge: Request Header Parser Microservice

Link to the challenge:

Hi @dLetulle, a couple of things to notice:

1: How do you expect the IIFE you have posted to work,in the context of a server?
You are supposed to work on a small API project, running an express server, I don’t see how that function relate to that at all.

2:The purpose of the npm package you are using is to provide info of the “running” ip port, on the other hand with this project you are supposed to give back the information of the visitor, not your own! :slight_smile:

Pretty much if I were to make a GET request to <your-project>/api/whoami I am expected to see my IP (along with a couple of other info).
It’s a “request header parse” meaning you are supposed to work with the incoming request :slight_smile:

Hope it helps :sparkles:

1 Like

Yeah, I completely misunderstood the challenge apparently. :man_facepalming: I was able to complete the challenge now. Thank you for your help!