Skip to content

Node.js based forum software built for the modern web

new route to get recent posts

Baris Soner Usaklic028761857b3
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) {