Created
September 10, 2010 10:02
-
-
Save BenJam/573407 to your computer and use it in GitHub Desktop.
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
//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