From c028761857b3311a23ac8964573d0ef49f2c9766 Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Wed, 5 Mar 2014 16:49:42 -0500 Subject: [PATCH] new route to get recent posts --- public/language/en_GB/global.json | 2 ++ src/routes/api.js | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/public/language/en_GB/global.json b/public/language/en_GB/global.json index b41f69b915..48e8109bd7 100644 --- a/public/language/en_GB/global.json +++ b/public/language/en_GB/global.json @@ -64,6 +64,8 @@ "posted": "posted", "in": "in", + "norecentposts": "No Recent Posts", + "norecenttopics": "No Recent Topics", "recentposts": "Recent Posts", "recentips": "Recently Logged In IPs", diff --git a/src/routes/api.js b/src/routes/api.js index 3274b4c584..1242e4b04a 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -276,6 +276,17 @@ var path = require('path'), }); }); + app.get('/recent/posts/:term?', function (req, res, next) { + var uid = (req.user) ? req.user.uid : 0; + posts.getRecentPosts(uid, 0, 19, req.params.term, function (err, data) { + if(err) { + return next(err); + } + + res.json(data); + }); + }); + app.get('/recent/:term?', function (req, res, next) { var uid = (req.user) ? req.user.uid : 0; topics.getLatestTopics(uid, 0, 19, req.params.term, function (err, data) {