Created
May 31, 2011 19:48
-
-
Save csanz/1001138 to your computer and use it in GitHub Desktop.
This file contains hidden or 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') | |
| , stylus = require('stylus') | |
| , nib = require('nib'); | |
| var app = express.createServer(express.logger()); | |
| // Configure general expressjs | |
| app.configure(function(){ | |
| this | |
| .use(express.cookieParser()) | |
| .use(express.bodyParser()) | |
| .use(express.errorHandler({dumpException: true, showStatck: true})) | |
| .use(express.session({ secret: 'supersecretnijakey'})) | |
| }); | |
| // Configure template engine | |
| app.configure(function(){ | |
| this | |
| .set('views', __dirname + '/views') | |
| .set('view engine', 'jade') | |
| .use(stylus.middleware({ | |
| src: __dirname + '/public', | |
| compile: compile | |
| })) | |
| .use(express.static(__dirname + '/public')) | |
| }); | |
| // Small compile helper | |
| function compile(str, path){ | |
| return stylus(str) | |
| .set('filename', path) | |
| .include(nib.path) | |
| } | |
| app.get('/', function(req, res) { | |
| res.render('home'); | |
| }); | |
| var port = process.env.PORT || 3000; | |
| console.log("Listening on " + port); | |
| app.listen(port); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment