Reputation: 1255
Here is my server.js code:
var express = require("express");
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!')
})
app.listen(3000, '0.0.0.0', function ()
console.log('Example app listening on port 3000!')
})
Really simple, I just want to see it working on my other devices before I continue.
It works fine obviously on my laptop I'm running it off, but nothing else. Any ideas?
Upvotes: 0
Views: 2630
Reputation: 2962
Try this maybe:
var http = require("http");
var express = require("express");
var service = express();
service.use(service.router);
service.get('/', function (req, res) {
res.send('Hello World!')
});
var server = http.createServer(service);
app.listen(3000, function () {
console.log('Example app listening on port 3000!')
});
Upvotes: 1
Reputation: 104
Try This:
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});
Read more: https://nodejs.org/api/http.html#http_server_listen_path_callback
Upvotes: 1