3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 12:29:26 +01:00

quote list and error page

This commit is contained in:
Luke Slater 2011-09-15 12:30:52 +01:00
parent ace90011be
commit 0ab31586e9
3 changed files with 12 additions and 0 deletions

View File

@ -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);

1
views/error.jade Normal file
View File

@ -0,0 +1 @@
p #{message}

3
views/quotes.jade Normal file
View File

@ -0,0 +1,3 @@
ul#quotes
-each quote in quotes
#{quote}