3

The documentation for Diet.js demonstrates a basic web server as:

var server = require('diet');
var app = server();

app.listen('http://localhost:8000');

app.get('/', function ($) {
  $.end('Hello World!');
});

The above code snippet only listens to localhost on port 8000. However, If I would want the server to listen to requests with domain as localhost as well as the ip-address (and probably even the machine name), is there a way to do it? I think there isn't, at least as per the developer's documentation but it would be great if someone could point to me a decent hack of some sort.

myTerminal
  • 1,596
  • 1
  • 14
  • 31

1 Answers1

3

You can change:

app.listen('http://localhost:8000');

to:

app.listen(8000);

or:

app.listen('http://0.0.0.0:8000/');
rsp
  • 107,747
  • 29
  • 201
  • 177