Skip to content

Instantly share code, notes, and snippets.

@BenJam
Created September 10, 2010 10:02
Show Gist options
  • Save BenJam/573407 to your computer and use it in GitHub Desktop.
Save BenJam/573407 to your computer and use it in GitHub Desktop.
//REQUIRE
var express = require('express');
var app = module.exports = express.createServer();
//CONFIG
app.configure(function(){
app.use(express.methodOverride());
app.use(express.bodyDecoder());
app.use(app.router);
app.use(express.compiler({ src: __dirname + '/public', enable: ['less'] }));
app.use(express.staticProvider(__dirname + '/public'));
app.use(express.errorHandler());
});
app.configure('development', function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
app.use(express.errorHandler());
});
//BEGIN ROUTING VALID PAGES
app.get('/:file.html', function(req,res){
res.sendfile(__dirname+'/'+file);
})
//LISTEN
if (!module.parent) {
app.listen(3000);
console.log("Express server listening on port %d", app.address().port)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment