forked from GitHub/dbot
quote list and error page
This commit is contained in:
parent
ace90011be
commit
0ab31586e9
@ -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
1
views/error.jade
Normal file
@ -0,0 +1 @@
|
||||
p #{message}
|
3
views/quotes.jade
Normal file
3
views/quotes.jade
Normal file
@ -0,0 +1,3 @@
|
||||
ul#quotes
|
||||
-each quote in quotes
|
||||
#{quote}
|
Loading…
Reference in New Issue
Block a user