Classes

The following classes are available globally.

  • A TemplateEngine for Kitura that uses GRMustache for templating.

    The default file extension for templates using this engine is mustache. If you do not explicitly provide a file extension in the call to response.render then this extension will be applied automatically.

    Usage Example:

       router.add(templateEngine: MustacheTemplateEngine())
    
       // An example of using a dictionary of [String: Any] parameters to be rendered
       router.get("/hello") { request, response, next in
           try response.render("MustacheExample.mustache", context: ["name": "World!"]])
           next()
       }
    

    For more information on Mustache templating, see: https://www.kitura.io/guides/templating/mustachetemplate.html

    See more

    Declaration

    Swift

    public class MustacheTemplateEngine: TemplateEngine