express-thymeleaf

0.3.0 • Public • Published

Express Thymeleaf

Build Status Coverage Status npm

Integrate ThymeleafJS with Express.

ThymeleafJS returns Promises of processed templates, but Express uses a callback mechanism for receiving rendered/processed HTML. This tiny module saves you having to do the boilerplate of stitching those 2 together to get them to work.

Installation

npm install express-thymeleaf --save

Usage

This module is still under development, denoted by the 0.x semver, in conjunction with the ThymeleafJS project, so expect anything below to change.

import express          from 'express';
import expressThymeleaf from 'express-thymeleaf';
import {TemplateEngine} from 'thymeleaf';
 
// Configure your application to use Thymeleaf via the express-thymeleaf module
let app = express();
let templateEngine = new TemplateEngine();
app.engine('html', expressThymeleaf(templateEngine));
app.set('view engine', 'html');
 
// Render views as you would normally in response to requests
app.get('/', function(request, response) {
  response.render('index');
});
 
app.listen(3000);

Readme

Keywords

none

Package Sidebar

Install

npm i express-thymeleaf

Weekly Downloads

10

Version

0.3.0

License

Apache-2.0

Unpacked Size

16.8 kB

Total Files

5

Last publish

Collaborators

  • ultraq