Controller.prototype.render >= 1.1.0
Purpose
Render the given template and end the request
Syntax
Controller#render
(
Numberstatus= 200
Stringtemplate
);
Parameters
status
- HTTP status number to use as response
template
- The template to render
Examples
Render with default status
// This index action will render the "static/index" template with a default status of 200
Static.setAction(function index(conduit) {
this.render('static/index');
});
// This error action will render the "static/error" template with a status of 404
Static.setAction(function error(conduit) {
this.render(404, 'static/error');
});
Syntax
Controller#render
(
Numberstatus= 200
Arraytemplates
);
Parameters
status
- HTTP status number to use as response
templates
- An array of template names, the first one found will be used
Examples
Render the first available template
// This index action will render the first template that is available
// In this example, the "static/does_exist" file will be used
Static.setAction(function error(conduit) {
this.render(['static/does_not_exist', 'static/does_exist']);
});
Comments