Skip to content

Instantly share code, notes, and snippets.

@stanpalatnik
Created March 3, 2012 21:28
Show Gist options
  • Save stanpalatnik/1968391 to your computer and use it in GitHub Desktop.
Save stanpalatnik/1968391 to your computer and use it in GitHub Desktop.
Setting up Dust.js
// Module dependencies.
var express = require('express')
, routes = require('./routes')
, http = require('http')
, fs = require('fs')
, path = require('path')
, cons = require('consolidate')
var app = express();
// assign the dust engine to .dust files
app.engine('dust', cons.dust);
app.configure(function(){
app.set('view engine', 'dust');
app.set('views', __dirname + '/views');
app.use(express.static(__dirname + '/public', {redirect: false}));
app.use(express.bodyParser());
app.use(express.session({ secret: 'very_unique_secret_string',
cookie: { maxAge: 1800000 }}));
app.use(app.router);
});
app.get('/', function(req, res){
res.render('index', {
title: 'Testing out dust.js server-side rendering'
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment