Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ultraq/express-thymeleaf

Open more actions menu

Repository files navigation

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);

About

Integrate ThymeleafJS with Express

Resources

License

Stars

Watchers

Forks

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.