Home > Enterprise >  Express app not working on local network without internet
Express app not working on local network without internet

Time:12-02

I have an express app with which I want other computers in the same WIFI Network to connect to it but without the internet being available.

The main PC which is hosting the app has the following fixed IP: 192.168.1.60

And I have done the following code in my server.js

app.listen(5000, '192.168.1.60' () => {
  console.log(`Server launched with port 5000`);
});

So whenever I try to access the app from another machine, it does not load unless I have internet.

Is there a way to make it work without the internet?

CodePudding user response:

app.get('/', (req, res) => {
  res.send('Hello User!')
})
app.listen(5000, () => {
  console.log(`Server launched with port ${port}`)
})

Make sure you enter following URL http://192.168.1.60:5000 in your browser

CodePudding user response:

When you say "without internet" - I'm going to assume that means that your devices are connected to the same local network but that there is no further connection via an ISP.

This should have no effect whatsoever on accessing your local server.

Provided that the connection to your server machine (192.168.1.60) functions from another device on your network by going to http://192.168.1.60:5000 then there will be no difference when there is no internet accessible via your network. Please provide more information as to what you mean by "without internet" and how you are testing this.

You must ensure that:

  • Each device has an assigned IP on the network and can access the network
  • No "host isolation" features are enabled on your switch/router
  • Your server device (192.168.1.60) does not have a firewall blocking the connection

I don't have enough reputation to comment, so had to post this answer - please provide more details and I can help more

  • Related