Skip to content

Instantly share code, notes, and snippets.

@jharjono
Created March 4, 2011 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jharjono/855667 to your computer and use it in GitHub Desktop.
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
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