Created
March 3, 2012 21:28
-
-
Save stanpalatnik/1968391 to your computer and use it in GitHub Desktop.
Setting up Dust.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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