Vishruth Subramanian
Vishruth Subramanian

Reputation: 141

Unable to access node server created on windows machine on other devices

I am building a web app using Node and express. On my PC, I run the app by typing node app.js which gets the server running on http://localhost:1008/

On my android phone, which is connected to the same network, I typed
http://<ipv4 address>:1008/ but it doesn't work. The wifi network is set to private(home) and i tried turning off firewall, but still it doesn't work
I am using Windows 7 PC.

My app (just a test app)

const express = require('express')
const app = express()

app.set('view engine','ejs')

app.get("/",(req,res)=>{
    res.render('home')
})

app.get("/about",(req,res)=>{
    res.render("about")
})

app.listen(3000,()=>{console.log("server running on port 3000"})

Any help is appreciated

Upvotes: 1

Views: 1701

Answers (1)

Vikas Keskar
Vikas Keskar

Reputation: 1248

There are several possibilities that you are not able to access your node server on other devices,

  1. You might have installed antivirus on your machine, which is protecting your firewall. So, it is not allowing to access the port on which your application server is running.
  2. Your windows defender is not allowing you to access port outside your host machine.

Solution for above problems is,

  1. If you have antivirus, then you need to allow port from antivirus firewall setting
  2. If port access is denied by windows defender/firewall, then you need to allow port from windows firewall

Upvotes: 1

Related Questions