2017-08-15 14:29:27 +03:00
|
|
|
var debug = require('ghost-ignition').debug('channels:render'),
|
|
|
|
formatResponse = require('./format-response'),
|
2017-11-10 15:44:29 +03:00
|
|
|
renderer = require('./renderer');
|
2016-02-09 17:14:24 +03:00
|
|
|
|
2017-11-06 15:17:24 +03:00
|
|
|
module.exports = function renderChannel(req, res) {
|
2016-10-03 11:33:14 +03:00
|
|
|
debug('renderChannel called');
|
2017-11-06 15:17:24 +03:00
|
|
|
return function renderChannel(result) {
|
2017-11-05 15:45:43 +03:00
|
|
|
// Renderer begin
|
|
|
|
// Format data 2
|
|
|
|
// Do final data formatting and then render
|
2017-11-10 15:44:29 +03:00
|
|
|
var data = formatResponse.channel(result);
|
2017-11-05 15:45:43 +03:00
|
|
|
|
|
|
|
// Render Call
|
2017-11-10 15:44:29 +03:00
|
|
|
return renderer(req, res, data);
|
2017-11-06 15:17:24 +03:00
|
|
|
};
|
|
|
|
};
|