My node.js web - app in LAN
How to host your node.js web - app in LAN ?
This was one of the questions I got when I was developing my web-app that at the beginning will be used only on LAN.
1. Open your Command Prompt and type ipconfig, from there get information about IPv4 Address - you will get something like this (it is just example - you will have different IP):
IPv4 Address. . . . . . . . . . . : 192.168.1.1
2. Then Open your file which you use to start your server & web-app, like for example app.js and in the place where you add the listener write this:
3. Start your app with node app.js and if you get no errors it should be good to go.
4. Your application runs on 192.168.1.1:3000 and you can open it in browser on pc/phone/tablet that is in the same LAN as you are.
*(I am using Windows)
This was one of the questions I got when I was developing my web-app that at the beginning will be used only on LAN.
1. Open your Command Prompt and type ipconfig, from there get information about IPv4 Address - you will get something like this (it is just example - you will have different IP):
IPv4 Address. . . . . . . . . . . : 192.168.1.1
2. Then Open your file which you use to start your server & web-app, like for example app.js and in the place where you add the listener write this:
const PORT = "3000";
const IP = '192.168.1.1';
app.listen(PORT, IP, () => {
console.log(`Server running at Port ${IP +': '+ PORT}`);
});
3. Start your app with node app.js and if you get no errors it should be good to go.
4. Your application runs on 192.168.1.1:3000 and you can open it in browser on pc/phone/tablet that is in the same LAN as you are.
*(I am using Windows)
Komentāri
Ierakstīt komentāru