From bf68826f9642a956df75d6c0f4b72d1e8576fce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas?= Date: Sun, 2 Jun 2013 00:02:16 +0200 Subject: [PATCH] Started editing and adding real content. --- server.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/server.js b/server.js index 35aced1..5b71762 100644 --- a/server.js +++ b/server.js @@ -34,6 +34,16 @@ function compile(str, path) { .use(nib()); } +function render_index(player_number, stats_number, players) { + res.render('index', + { + title: 'My Game', + player_num: player_number, + stats_num: stats_number, + player_list: players + }); +} + app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.logger('dev')) @@ -66,20 +76,15 @@ app.get('/', function (req, res) { console.log(players); }); + console.log('Statistics'); database.get("SELECT COUNT(*) FROM players", function (err, row) { player_number = row; }); database.get("SELECT COUNT(*) FROM stats", function (err, row) { stats_number = row; + render_index(player_number, stats_number, players); }); - res.render('index', - { - title: 'My Game', - player_num: player_number, - stats_num: stats_number, - player_list: players - }); }); });