keystone
Version:
Web Application Framework and Admin GUI / Content Management System built on Express.js and Mongoose
18 lines (16 loc) • 391 B
JavaScript
var async = require('async');
module.exports = function (req, res) {
var keystone = req.keystone;
var counts = {};
async.each(keystone.lists, function (list, next) {
list.model.count(function (err, count) {
counts[list.key] = count;
next(err);
});
}, function (err) {
if (err) return res.apiError('database error', err);
return res.json({
counts: counts,
});
});
};