utility/aliased/aliased_protocol.js
function () {
  /**
   * Renders a view from template and sends data to client
   * @param  {Object}   opts     Configurable options (see periodicjs.core.responder for more details)
   * @param {string} opts.extname Periodic extension which may have template in view folder
   * @param {string} opts.viewname Name of template file
   * @param {string} opts.themefileext Periodic theme which may have template in view folder
   * @param {string} opts.viewfileext The file extension of the view file
   * @param {Object} opts.req Express request object
   * @param {Object} opts.res Express response object
   * @param  {Function} [callback] Optional callback function
   * @return {Function}          If callback is not defined returns a Promise which resolves with rendered template
   */
  let fn = function handleDocumentQueryRender (opts = {}, callback) {
    let { extname, viewname, themefileext, viewfileext, responseData } = opts;
    let themename = this.theme;
    let fileext = (typeof themefileext === 'string') ? themefileext : viewfileext;
    return this._utility_responder.render(responseData || {}, Object.assign(opts, { themename, fileext, skip_response: true }))
      .then(result => {
        this.protocol.respond(opts.req, opts.res, {
          responder_override: result
        });
        if (typeof callback === 'function') callback(null, result);
        else return Promisie.resolve(result);
      })
      .catch(e => {
        this.protocol.error(opts.req, opts.res, { err: e });
        if (typeof callback === 'function') callback(e);
        else return Promisie.reject(e);
      });
  };
  let message = 'CoreController.handleDocumentQueryRender: Use CoreController.responder.render with an HTML adapter or CoreController._utility_responder.render instead';
  return wrapWithDeprecationWarning.call(this, fn, message);
}
function () {
  /**
   * Renders a view from template and sends data to client
   * @param  {Object}   opts     Configurable options (see periodicjs.core.responder for more details)
   * @param {string} opts.extname Periodic extension which may have template in view folder
   * @param {string} opts.viewname Name of template file
   * @param {string} opts.themefileext Periodic theme which may have template in view folder
   * @param {string} opts.viewfileext The file extension of the view file
   * @param {Object} opts.req Express request object
   * @param {Object} opts.res Express response object
   * @param  {Function} [callback] Optional callback function
   * @return {Function}          If callback is not defined returns a Promise which resolves with rendered template
   */
  let fn = function handleDocumentQueryRender (opts = {}, callback) {
    let { extname, viewname, themefileext, viewfileext, responseData } = opts;
    let themename = this.theme;
    let fileext = (typeof themefileext === 'string') ? themefileext : viewfileext;
    return this._utility_responder.render(responseData || {}, Object.assign(opts, { themename, fileext, skip_response: true }))
      .then(result => {
        this.protocol.respond(opts.req, opts.res, {
          responder_override: result
        });
        if (typeof callback === 'function') callback(null, result);
        else return Promisie.resolve(result);
      })
      .catch(e => {
        this.protocol.error(opts.req, opts.res, { err: e });
        if (typeof callback === 'function') callback(e);
        else return Promisie.reject(e);
      });
  };
  let message = 'CoreController.handleDocumentQueryRender: Use CoreController.responder.render with an HTML adapter or CoreController._utility_responder.render instead';
  return wrapWithDeprecationWarning.call(this, fn, message);
}
function ( ) { /**
   * Renders a view from template and sends data to client
   * @param  {Object}   opts     Configurable options (see periodicjs.core.responder for more details)
   * @param {string} opts.extname Periodic extension which may have template in view folder
   * @param {string} opts.viewname Name of template file
   * @param {string} opts.themefileext Periodic theme which may have template in view folder
   * @param {string} opts.viewfileext The file extension of the view file
   * @param {Object} opts.req Express request object
   * @param {Object} opts.res Express response object
   * @param  {Function} [callback] Optional callback function
   * @return {Function}          If callback is not defined returns a Promise which resolves with rendered template
   */ let fn = function handleDocumentQueryRender ( opts = { } , callback ) { let { extname , viewname , themefileext , viewfileext , responseData } = opts ; let themename = this . theme ; let fileext = ( typeof themefileext === 'string' ) ? themefileext : viewfileext ; return this . _utility_responder . render ( responseData || { } , Object . assign ( opts , { themename , fileext , skip_response : true } ) ) . then ( result => { this . protocol . respond ( opts . req , opts . res , { responder_override : result } ) ; if ( typeof callback === 'function' ) callback ( null , result ) ; else return Promisie . resolve ( result ) ; } ) . catch ( e => { this . protocol . error ( opts . req , opts . res , { err : e } ) ; if ( typeof callback === 'function' ) callback ( e ) ; else return Promisie . reject ( e ) ; } ) ; } ; let message = 'CoreController.handleDocumentQueryRender: Use CoreController.responder.render with an HTML adapter or CoreController._utility_responder.render instead' ; return wrapWithDeprecationWarning . call ( this , fn , message ) ; }
Creates a function that will render a template and send HTTP response to client. Alias for CoreController._utility_responder.render
@return {Function} A function that will render a template and send data to client
Creates a function that will render a template and send HTTP response to client . Alias for CoreController . _utility_responder . render