Skip to content

Instantly share code, notes, and snippets.

@micahasmith
Created December 23, 2011 21:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micahasmith/1515404 to your computer and use it in GitHub Desktop.
Save micahasmith/1515404 to your computer and use it in GitHub Desktop.
Example node.js app using hogan.js and express.js
var express=require('express'),
hogan=require('hogan.js'),
adapter=require('./hogan-express.js'),
app = express.createServer();
app.configure(function(){
app.use(express.static(__dirname + '/public'));
app.use(express.logger());
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(app.router);
app.use(express.errorHandler({dumpExceptions:true,showStack:true}));
app.set('view engine','hogan.js');
app.set('view options',{layout:false});
app.set('views',__dirname+ '/views');
app.register('hogan.js',adapter.init(hogan));
});
app.get("/",function(req,res,next) {
res.render("index",{name:"micah"});
});
app.listen(8080);
@articice
Copy link

Please include some files into views/, so that users can download and run it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment