diff --git a/server.js b/server.js index 7437369..52b6373 100644 --- a/server.js +++ b/server.js @@ -54,6 +54,8 @@ app.use(express.static(__dirname + '/public')); app.get('/', function (req, res) { var player_number = 0; var stats_number = 0; + var players = new Array(); + database.get("SELECT COUNT(*) FROM players", function (err, row) { player_number = row; }); @@ -61,11 +63,16 @@ app.get('/', function (req, res) { stats_number = row; }); + database.each("SELECT * FROM players", function(err, row) { + players.push(row); + }); + res.render('index', { title: 'My Game', player_num: player_number, - stats_num: stats_number + stats_num: stats_number, + player_list: players }); }); diff --git a/views/index.jade b/views/index.jade index 42ede3c..6647766 100644 --- a/views/index.jade +++ b/views/index.jade @@ -5,6 +5,11 @@ block content | Registered players: #{player_num} p | Stats registered: #{stats_num} + p + ul + each player in player_list + li #{player.name} + block sidebar .widget h1 Access