var connect = require('connect');
var http = require('http');
var path = require('path');
var serveStatic = require('serve-static');

var app = connect();
app.use('/assets', serveStatic(path.join(path.dirname(require.resolve('classets/package')), 'public')));
app.use(serveStatic(path.join(__dirname, 'public')));

var port = process.env.PORT || 11583;
http.createServer(app).listen(port, function() {
	console.log('Server started http://localhost:' + port);
});


var connect = require('connect');
var http = require('http');
var path = require('path');
var serveStatic = require('serve-static');

var app = connect();
app.use('/assets', serveStatic(path.join(path.dirname(require.resolve('classets/package')), 'public')));
app.use(serveStatic(path.join(__dirname, 'public')));

var port = process.env.PORT || 11583;
var addr = process.env.BINDING_ADDR || 'localhost';
http.createServer(app).listen(port, host, function() {
	console.log('Server started http://' + addr + ':' + port);
});


Allow to customize the address classeur listens to
Allow to customize the address classeur listens to

The behavior of listen is a little queer, especially in regard of binding to an IPv6 socket. Some OS consider such socket to be listening both for IPv4 or IPv6, other OS have IPv6 sockets listening only to IPv6, and not to IPv4.

This change introduces a BINDING_ADDR environment variable to alllow to customize listening address.
If omitted, it binds to localhost instead.

Reference: https://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback