Skip to content
Browse files

Merge pull request #56 from trodrigues/master

Splitting create server logic from inside listen method
  • Loading branch information...
2 parents 52f93fa + 04b4ee1 commit 8e8a73421a9476db586fd50882cd426a2fc405e8 @indexzero indexzero committed May 10, 2012
Showing with 11 additions and 7 deletions.
  1. +11 −7 lib/flatiron/plugins/http.js
View
18 lib/flatiron/plugins/http.js
@@ -69,13 +69,8 @@ exports.attach = function (options) {
app.listen(port, host, callback);
});
};
-
- app.listen = function (port, host, callback) {
- if (!callback && typeof host === 'function') {
- callback = host;
- host = null;
- }
-
+
+ app.createServer = function(){
app.server = union.createServer({
after: app.http.after,
before: app.http.before.concat(function (req, res) {
@@ -86,6 +81,15 @@ exports.attach = function (options) {
headers: app.http.headers,
limit: app.http.limit
});
+ };
+
+ app.listen = function (port, host, callback) {
+ if (!callback && typeof host === 'function') {
+ callback = host;
+ host = null;
+ }
+
+ app.createServer();
return host
? app.server.listen(port, host, callback)

0 comments on commit 8e8a734

Please sign in to comment.
Something went wrong with that request. Please try again.