Skip to content

Instantly share code, notes, and snippets.

@nhunzaker
Created February 12, 2012 01:26
Show Gist options
  • Save nhunzaker/1805617 to your computer and use it in GitHub Desktop.
Save nhunzaker/1805617 to your computer and use it in GitHub Desktop.
The http server plugin for flatiron
// found in lib/flatiron/plugins/http.js
app.start = function (port, host, callback) {
[... code ...]
app.listen(port, host, callback);
};
app.listen = function (port, host, callback) {
[... code ...]
app.server = union.createServer({
after: app.http.after,
before: app.http.before.concat(function (req, res) {
if (!app.router.dispatch(req, res, app.http.onError || union.errorHandler)) {
if (!app.http.onError) res.emit('next');
}
}),
headers: app.http.headers,
limit: app.http.limit
});
[... code ...]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment