Created
December 23, 2011 21:29
-
-
Save micahasmith/1515404 to your computer and use it in GitHub Desktop.
Example node.js app using hogan.js and express.js
This file contains hidden or 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
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please include some files into views/, so that users can download and run it.