From 4952a11e105da04c170e610b477c3b274b1da382 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Sat, 26 Apr 2014 19:44:16 +0200 Subject: [PATCH] Added port to config --- README.md | 2 +- client/js/chat.js | 14 +++++++------- config.js | 1 + lib/server.js | 3 ++- package.json | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 554d43da..2d2ad542 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ These are the commands currently implemented: `npm install` 5. Run the server -`npm start` or `nodejs index.js` +`npm start` or `node index.js` 6. Open your browser `http://localhost:9000` diff --git a/client/js/chat.js b/client/js/chat.js index 1bb99165..06d85535 100644 --- a/client/js/chat.js +++ b/client/js/chat.js @@ -182,12 +182,6 @@ $(function() { "partial": function(id) { return new Handlebars.SafeString(render(id, this)); }, - "uri": function(text) { - text = escape(text); - return URI.withinString(text, function(url) { - return "" + url + ""; - }); - }, "slice": function(items, block) { var limit = block.hash.limit; var rows = $.map(items, function(i) { @@ -202,6 +196,12 @@ $(function() { } html += rows.slice(-limit).join(""); return html; - } + }, + "uri": function(text) { + text = escape(text); + return URI.withinString(text, function(url) { + return "" + url + ""; + }); + }, }); }); diff --git a/config.js b/config.js index e3d409b7..4ff1d78a 100644 --- a/config.js +++ b/config.js @@ -1,4 +1,5 @@ module.exports = { + port: 9000, theme: "/themes/default.css", defaults: { nick: "shout_user", diff --git a/lib/server.js b/lib/server.js index 61cc2b09..a0958090 100644 --- a/lib/server.js +++ b/lib/server.js @@ -37,10 +37,11 @@ var events = [ module.exports = listen; function listen() { + var port = config.port || 9000; var app = http() .use(index) .use(http.static("client")) - .listen(9000); + .listen(port); var self = this; sockets = io.listen(app, {log: 0}).sockets.on("connection", function(s) { diff --git a/package.json b/package.json index 4153461f..59e34eb9 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ ], "main": "./index.js", "scripts": { - "start": "nodejs index.js" + "start": "node index.js" }, "repository": { "type": "git",