i'm using express for the server of my node.js app, the server is set up like this:
const app = express();
const server = app.listen(port);
i'm also using the server for a socket.io server if that makes a difference:
const server = io(server, { pingTimeout: 60000, pingInterval: 500 });
is there a way to get the ip/url of the server? something like:
console.log(server.ip); //returns something like 42.32.208.189 or 192.168.1.190
EDIT: alright figured it out, there's useful package (https://github.com/indutny/node-ip) that allows you to just do
const ip = require("ip");
console.log(ip.address()); //returns something like 42.32.208.189 or 192.168.1.190