Coding

In the index.js Start by importing express and initializing the app and sending all the get requests to the host with IP address of the client.

const app = require('express')().get("/*", (req, res) => {res.send({IP:req.headers["x-forwarded-for"]?.split(",").shift() ||req.socket?.remoteAddress });});
app.listen(3000, () => console.log("Listening on port 3000"));

Now run the code with 

node api/index.js

and open localhost:3000 on the browser.

Code

https://json.commudle.com/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBak1YIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--cb84300e538d0f55e24bd3a51c31d1f82b2a0236/Screenshot%20from%202021-09-18%2008-54-15.png

Since the app is locally hosted you get the localhost host IP address that is 

::1

 

 

 

 

Discussion

3

0