Created
July 31, 2013 18:28
-
-
Save anthonybrown/6124740 to your computer and use it in GitHub Desktop.
basic node server script
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
// This is your typical Express app. | |
// We have already worked with something like this | |
var express = require('express') | |
, path = require('path'); | |
var app = express(); | |
app.configure( function () { | |
'use strict'; | |
app.set('view engine', 'jade'); | |
app.set('views', __dirname + '/views'); | |
app.use(require('stylus').middleware(__dirname + '/public')); | |
app.use(express.logger('dev')); | |
app.use(express.favicon()); | |
app.use(express.static(path.join(__dirname, 'public'))); | |
}); | |
app.get('/', function (req, res) { | |
'use strict'; | |
res.render('index'); | |
}); | |
app.get('/:anyname', function (req, res) { | |
'use strict'; | |
res.render(req.params.anyname); | |
}); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment