Skip to content

Commit

Permalink
Adding configuration options
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamrege committed Mar 2, 2012
1 parent 0345f87 commit b28e5b7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
16 changes: 13 additions & 3 deletions notify.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/** CONFIGURATION **/

HOST = "192.168.1.153",
PORT = "3000"

/** CONFIGURATION **/

var express = require('express')
, app = express.createServer()
, redis = require('redis')
Expand All @@ -7,7 +14,7 @@ app.use(express.bodyParser());
app.use(express.static(__dirname + '/public'));
app.set('view engine', 'jade');

app.listen(3000);
app.listen(PORT);

const DB = redis.createClient();

Expand All @@ -16,7 +23,9 @@ app.get('/', function(req, res) {
});

app.get('/games/new', function (req, res) {
data = { gameid: Math.random().toString(36).substring(12) }
data = { HOST: HOST, PORT: PORT,
gameid: Math.random().toString(36).substring(12)
}

// Create the game in DB
DB.sadd('games', data['gameid']);
Expand All @@ -28,7 +37,8 @@ app.get('/game/:gameid/:nick', function (req, res) {
res.send("No such game", 404);
else {
DB.sadd(req.params.gameid, req.params.nick)
params = { gameid: req.params.gameid,
params = { HOST: HOST, PORT: PORT,
gameid: req.params.gameid,
nick: req.params.nick,
ts: Date.now()
}
Expand Down
2 changes: 1 addition & 1 deletion views/games/join.jade
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
script
$(document).ready(function() {
var socket = io.connect("http://192.168.1.153:3000");
var socket = io.connect("http://#{HOST}:#{PORT}");
var content = $('#content');

socket.on('connect', function() {
Expand Down
3 changes: 1 addition & 2 deletions views/games/new.jade
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ script

function process_action(action, data) {
nick = $("#dancefloor #" + data.nick);
console.log(nick);

// action is an array ['event string', 'group1'], so we need action[1]
nick.attr('class', 'user').addClass(action[1]);
}

$(document).ready(function() {
var socket = io.connect("http://192.168.1.153:3000");
var socket = io.connect("http://#{HOST}:#{PORT}");
var dancefloor = $('#dancefloor');

socket.on('connect', function() {
Expand Down

0 comments on commit b28e5b7

Please sign in to comment.