olado/doT — pull request #55 by acstll (2012-12-31 18:19:24+00:00)
Title: Added basic support for the Express framework.

I added a single function to the node module (index.js) to support the Express framework.

No dependencies. The main doT.js remains untouched.

I guess there's reasons for this to be in its own module/repo, as in https://github.com/cstigler/express-dot and also reasons for this to be included in doT.

You could also have an express.js file in the repo with some more functionality (like cache support) and require it in index.js

I think it's useful to just include the doT module in for project and use it right away with Express,
which seems to be widely adopted (I don't know statistically). I've been using it like that for a while.

Usage in an Express app is simple, as expected:

app.set('view engine', 'dot');

if you're using .dot files. Or:

app.engine('html', require('dot').__express);
app.use('view engine', 'html');

if you want to use any other extension.

I hope this is useful if it makes sense to you.

Happy new year.