Skip to content

Instantly share code, notes, and snippets.

@paulfryzel
Created January 9, 2013 17:54
Show Gist options
  • Save paulfryzel/4495234 to your computer and use it in GitHub Desktop.
Save paulfryzel/4495234 to your computer and use it in GitHub Desktop.
var connect = require("connect"),
director = require("director"),
union = require("union");
var router = new director.http.Router();
router.get('/', function () {
this.res.writeHead(200, { 'Content-Type': 'text/plain' })
this.res.end('Hello, World!\n');
});
var sidewalk = union.createServer({
buffer: false,
before: [
connect.favicon(),
connect.logger('dev'),
function (req, res) {
router.dispatch(req, res, function (err) {
if (err) {
res.writeHead(404);
res.end();
}
})
}
],
after: []
}).listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment