aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/app.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/app.js b/lib/app.js
index d2a029b..b122f1d 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -21,7 +21,7 @@ function App(sbot, config) {
var conf = config.patchfoo || {}
this.port = conf.port || 8027
- this.host = conf.host || '::1'
+ this.host = conf.host || 'localhost'
var base = conf.base || '/'
this.opts = {
@@ -48,12 +48,15 @@ function App(sbot, config) {
App.prototype.go = function () {
var self = this
- http.createServer(function (req, res) {
+ var server = http.createServer(function (req, res) {
new Serve(self, req, res).go()
- }).listen(self.port, self.host, function () {
+ })
+ if (self.host === 'localhost') server.listen(self.port, onListening)
+ else 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)
- })
+ }
// invalidate cached About info when new About messages come in
pull(