Created
December 19, 2010 00:23
-
-
Save Ezku/747004 to your computer and use it in GitHub Desktop.
Trivial express test app
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'); | |
var app = module.exports = express.createServer(); | |
// Configuration | |
app.configure(function(){ | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'jade'); | |
app.use(express.bodyDecoder()); | |
app.use(express.methodOverride()); | |
app.use(app.router); | |
app.use(express.staticProvider(__dirname + '/public')); | |
}); | |
app.configure('development', function(){ | |
app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); | |
}); | |
app.configure('production', function(){ | |
app.use(express.errorHandler()); | |
}); | |
// Routes | |
app.get('/', function(req, res){ | |
res.render('index', { | |
locals: { | |
title: 'Express' | |
} | |
}); |
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
express = require 'express' | |
app = module.exports = express.createServer() | |
app.configure -> | |
app.set 'views', __dirname + '/views' | |
app.set 'view engine', 'jade' | |
app.use express.bodyDecoder() | |
app.use express.methodOverride() | |
app.use app.router | |
app.use express.staticProvider __dirname + '/public' | |
app.configure 'development', -> | |
app.use express.errorHandler dumpExceptions: true, showStack: true | |
app.configure 'production', -> | |
app.use express.errorHandler() | |
app.get '/', (req, res) -> | |
res.render 'index', | |
locals: | |
title: 'Express' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment