RingoJS

Module middleware/render

This module provides middleware for rendering responses using ringo/mustache.

This middleware installs a render function in the application object which is used to render HTTP responses. The behaviour of app.render can be tweaked by setting the following properties:

  • render.base - the base path or repository to look for templates
  • render.helpers - helper functions that will be merged in the context
  • render.master - master template which is applied on the top of processing the page with template given in the .render function.
  • render.contentType - MIME type to use for HTTP response
  • render.charset - charset name to use for HTTP response

Example

app.configure("render");
app.render.base = module.resolve("templates");
app.render("index.tmpl", {data: "Hello World!"});

Functions


middleware (next, app)

Middleware for template based response generation.

Parameters

Function next

the wrapped middleware chain

Object app

the Stick Application object

Returns

Function

a JSGI middleware function