I'm trying to decide on a templating engine to use -- I've seen lots of single page examples with template engines...I'm trying to find a realistic example of handling two different pages but re-using the same basic layout for all pages that can also include a partial for the navigation (nav.dust).
I'm leaning towards dust.js, but handlebars.js is fine too...
app.get('/page1', function(req, res, next) {
res.render('page1', {
title: 'This is a test'
});
});
app.get('/page2', function(req, res, next) {
res.render('page2', {
title: 'This is a test2'
});
});
I want page1 and page2 to both inherit from a basic layout.dust file (or layout.hbs) but override things like title, and body's content area, with a partial that includes a nav.dust file.
I'm having difficulting coming up with what the ./views directory would contain.
I figured out how to do it, and setup a github demo here: https://github.com/chovy/express-template-demo
I'ce created a demo "TO-DO List" app, you can check it working at:
http://watchdev.com.ar/dustjs-slim-rest-app-example/
and the source is here:
https://github.com/PabloGancharov/dustjs-slim-rest-app-example