diff --git a/README.md b/README.md index eacd8893..6d785762 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,6 @@ follow these steps: - To deploy to stating (rdocumentation.datacamp-staging.com), merge to master - To deploy to production, add a tag which starts with `release-` - The rdocumentation app is hosted on DataCamp's infrastructure, on our AWS ECS cluster. ## What the CI does diff --git a/api/controllers/PackageController.js b/api/controllers/PackageController.js index 9660ebd8..c3555574 100644 --- a/api/controllers/PackageController.js +++ b/api/controllers/PackageController.js @@ -42,7 +42,6 @@ module.exports = { * @apiSuccess {Integer} versions.maintainer_id Id of the maintainer of the package version * @apiSuccess {String} type Always 'package' */ - findByName: function(req, res) { var packageName = req.param('name'); @@ -85,8 +84,10 @@ module.exports = { * @api {get} /packages List all packages * @apiName Get Packages * @apiGroup Package - * @apiDescription Return an array of package object containing listed attributes + * @apiDescription Return an array of package object containing listed attributes and total number of package objects header. * + * @apiHeader (Header) {String} x-total-count total count of packages. + * * @apiParam {String} limit the number to use when limiting records to send back (useful for pagination) * @apiParam {String} skip the number of records to skip when limiting (useful for pagination) * @apiParam {String} sort the order of returned records, e.g. `name ASC` or `name DESC` @@ -106,15 +107,16 @@ module.exports = { var limit = Utils.parseLimit(req); var offset = Utils.parseSkip(req); var sort = Utils.parseSort(req); - var criteria = Utils.parseCriteria(req); + var criteria = Utils.parseCriteria(req); Package.findAll({ - where: criteria, limit: limit, + where: criteria, offset: offset, order: sort, include: [] }).then(function(packages) { + res.set('X-Total-Count', packages.length); return res.json(packages); }).catch(function(err) { return res.negotiate(err); diff --git a/config/routes.js b/config/routes.js index 100fb78e..bb2e82ba 100644 --- a/config/routes.js +++ b/config/routes.js @@ -23,7 +23,7 @@ module.exports.routes = { // Homepage 'get /': 'HomeController.index', - 'get /status': 'HomeController.status', + 'get /status': 'HomeController.status', // Authentication 'get /login': 'AuthController.login', diff --git a/views/layout.ejs b/views/layout.ejs index 5b02fa93..3c0b2830 100644 --- a/views/layout.ejs +++ b/views/layout.ejs @@ -58,7 +58,7 @@ <% } %> - +