diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-09-02 12:46:05 -0700 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-09-02 12:46:05 -0700 |
commit | 445387df1c63790ab1d71cb15baae871023c8531 (patch) | |
tree | 88266e7aea4473b4defd265a7c97188075037288 /lib/app.js | |
parent | 87a69610fde53178a1253a2a081d5ff19888b018 (diff) | |
download | patchfoo-445387df1c63790ab1d71cb15baae871023c8531.tar.gz patchfoo-445387df1c63790ab1d71cb15baae871023c8531.zip |
Fix listening on localhost and printing address
Diffstat (limited to 'lib/app.js')
-rw-r--r-- | lib/app.js | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -76,11 +76,11 @@ App.prototype.go = function () { var server = http.createServer(function (req, res) { new Serve(self, req, res).go() }) - if (self.host === 'localhost') server.listen(self.port, onListening) - else server.listen(self.port, self.host, onListening) + server.listen(self.port, self.host, onListening) function onListening() { - var host = /:/.test(self.host) ? '[' + self.host + ']' : self.host - self.log('Listening on http://' + host + ':' + self.port) + var addr = server.address() + var host = addr.family === 'IPv6' ? '[' + addr.address + ']' : addr.address + self.log('Listening on http://' + host + ':' + addr.port) } // invalidate cached About info when new About messages come in |