Read the statement by Michael Teeuw here.
wlan0 IP address in config file
-
I want to open the server with the first IP address of the wlan0 network by putting ifaces.wlan0[0].address in the address part of the config.js file. I modified the code to do this, but I get an error on the screen.
const os = require("os"); const ifaces = os.networkInterfaces(); const wlan0Address = ifaces.wlan0[0].address; let config = { address: wlan0Address, // The first IP address of the wlan0 network interface port: 8080, // etc... };
If I write the code as above, I don’t know why, but when I open the server, I don’t see any module screen on the web server. So I thought the modules were a problem, so I modified the code as follows, and the modules come out well from the web server at that address.
/*const os = require("os"); const ifaces = os.networkInterfaces(); const wlan0Address = ifaces.wlan0[0].address; */ let config = { address: "xxx.xxx.xxx.xxx", // static address port: 8080, // etc... };
The conclusion that I came up with through this process is
const os = require("os"); const ifaces = os.networkInterfaces(); const wlan0Address = ifaces.wlan0[0].address;
I think the code in the above part is problematic, I want to know exactly what the problem is with this code, and how to fix the code to solve it.
In addition, since English is not the main language, I hope you understand that my writing may have some grammatical errors.
-
@hikano765 a better thing would be to change the address: to address:“0.0.0.0”
then it will listen on all the active network adapters .you will also have to fix the ipWhitelist to allow apps from outside systems to connect
while you are developing your mm solution it’s easiest to do
ipWhitelist:[],to allow apps from any system on your local betwork