summaryrefslogtreecommitdiff
path: root/lib/bucky.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bucky.js')
-rw-r--r--lib/bucky.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/bucky.js b/lib/bucky.js
index a429fb3..997d680 100644
--- a/lib/bucky.js
+++ b/lib/bucky.js
@@ -103,6 +103,19 @@ var bucky = module.exports = {
/* KEYWORDS */
+ ensureKeyword: function (req, res, next){
+ var keyword = req.params.keyword
+ if (! keyword) {
+ res.sendStatus(404)
+ }
+ db.getKeyword(keyword).then(function(k){
+ if (! k) {
+ return res.sendStatus(404)
+ }
+ res.keyword = k
+ next()
+ })
+ },
ensureThreadsForKeyword: function (req, res, next){
var keyword = req.params.keyword
if (! keyword) {