Created
March 4, 2011 20:40
-
-
Save jharjono/855667 to your computer and use it in GitHub Desktop.
Quick Hello World using node.js and Express, shows all the config options for using Jade templating lang
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
var express = require('express'); | |
var app = express.createServer(); | |
// Configure static files directory | |
app.configure('development', function(){ | |
app.use(express.staticProvider(__dirname + '/public')); | |
app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); | |
}); | |
// configure views directory | |
app.configure(function(){ | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'jade'); | |
app.set('view options', {layout : false}); | |
}); | |
// Start defining RESTful path handlers | |
app.get('/', function(req, res){ | |
res.render('index.jade'); | |
}); | |
app.listen(9000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment