diff --git a/modules/web.js b/modules/web.js index 27c0576..8dfbf36 100644 --- a/modules/web.js +++ b/modules/web.js @@ -13,6 +13,14 @@ var webInterface = function(dbot) { app.get('/', function(req, res) { res.render('index', { }); }); + + app.get('/quotes/:key', function(req, res) { + if(dbot.db.quoteArrs.hasOwnProperty(req.params.key)) { + res.render('quotes', { 'quotes': dbot.db.quoteArrs[req.params.key] }); + } else { + res.render('error', { 'message': 'No quotes under that key.' }); + } + }); app.listen(1337); diff --git a/views/error.jade b/views/error.jade new file mode 100644 index 0000000..f78f6ae --- /dev/null +++ b/views/error.jade @@ -0,0 +1 @@ +p #{message} diff --git a/views/quotes.jade b/views/quotes.jade new file mode 100644 index 0000000..6d1acc4 --- /dev/null +++ b/views/quotes.jade @@ -0,0 +1,3 @@ +ul#quotes + -each quote in quotes + #{quote}