Skip to content

Node.js based forum software built for the modern web

most of the work for #1563

Julian Lam7425b72245cd
diff --git a/src/controllers/groups.js b/src/controllers/groups.js
index 68dfa53a60..28de099ea2 100644
--- a/src/controllers/groups.js
+++ b/src/controllers/groups.js
@@ -16,4 +16,16 @@ groupsController.list = function(req, res) {
});
};
+groupsController.details = function(req, res) {
+ groups.get(req.params.name, {
+ expand: true
+ }, function(err, groupObj) {
+ if (!err) {
+ res.render('groups/details', groupObj);
+ } else {
+ res.redirect('404');
+ }
+ });
+};
+
module.exports = groupsController;
diff --git a/src/routes/index.js b/src/routes/index.js
index a4021169fd..e719852ab2 100644
--- a/src/routes/index.js
+++ b/src/routes/index.js
@@ -138,6 +138,10 @@ function userRoutes(app, middleware, controllers) {
function groupRoutes(app, middleware, controllers) {
app.get('/groups', middleware.buildHeader, controllers.groups.list);
+ app.get('/api/groups', controllers.groups.list);
+
+ app.get('/groups/:name', middleware.buildHeader, controllers.groups.details);
+ app.get('/api/groups/:name', controllers.groups.details);
}