Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Express.js showing ERR_CONNECTION_REFUSED

I have installed node(v4.1.2) and express(4.13.3)

Node Server code:

var express = require('express');
var app = express();

app.get('/', function (req, res) {
  res.send('Hello World!');
});

var server = app.listen(3000, function () {
  var host = server.address().address;
  var port = server.address().port;

  console.log('Example app listening at http://%s:%s', host, port);
});

After running the node file and upon calling http://localhost:3000/ gives me ERR_CONNECTION_REFUSED.

like image 600
Rajan Sohal Avatar asked Dec 21 '25 22:12

Rajan Sohal


1 Answers

Have you run in powershell at server directory?

node app.js
like image 55
Pan Markosian Avatar answered Dec 24 '25 12:12

Pan Markosian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!