Merge pull request #157 from tschaub/address

Enclose literal IPv6 addresses in brackets
This commit is contained in:
Petr Sloup 2017-05-04 08:57:17 +02:00 committed by GitHub
commit 27e9dbfb4e

View file

@ -355,8 +355,11 @@ module.exports = function(opts) {
}); });
var server = app.listen(process.env.PORT || opts.port, process.env.BIND || opts.bind, function() { var server = app.listen(process.env.PORT || opts.port, process.env.BIND || opts.bind, function() {
console.log('Listening at http://%s:%d/', var address = this.address().address;
this.address().address, this.address().port); if (address.indexOf('::') === 0) {
address = '[' + address + ']'; // literal IPv6 address
}
console.log('Listening at http://%s:%d/', address, this.address().port);
}); });
process.on('SIGINT', function() { process.on('SIGINT', function() {