2022-04-05 21:31:49 +03:00
|
|
|
const debug = require('@tryghost/debug')('services:routing:renderer:render-entries');
|
2020-04-29 18:44:27 +03:00
|
|
|
const formatResponse = require('./format-response');
|
|
|
|
const renderer = require('./renderer');
|
2018-06-24 01:32:08 +03:00
|
|
|
|
2019-04-22 00:55:22 +03:00
|
|
|
/**
|
|
|
|
* @description Helper to handle rendering multiple resources.
|
|
|
|
*
|
|
|
|
* @param {Object} req
|
|
|
|
* @param {Object} res
|
|
|
|
* @returns {Closure)
|
|
|
|
*/
|
2018-06-24 01:32:08 +03:00
|
|
|
module.exports = function renderEntries(req, res) {
|
|
|
|
debug('renderEntries called');
|
2020-10-20 02:02:56 +03:00
|
|
|
return function renderEntriesClosure(result) {
|
2018-06-24 01:32:08 +03:00
|
|
|
// Format data 2
|
|
|
|
// Render
|
|
|
|
return renderer(req, res, formatResponse.entries(result));
|
|
|
|
};
|
|
|
|
};
|