Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added `app.listen()` for backwards compat

-ish
  • Loading branch information...
commit 6747ecc1c85499f067ad72ce8bfdc4f8b4a7f930 1 parent 6f303fb
@tj tj authored
Showing with 33 additions and 0 deletions.
  1. +15 −0 lib/proto.js
  2. +18 −0 test/app.listen.js
View
15 lib/proto.js
@@ -183,3 +183,18 @@ app.handle = function(req, res, out) {
}
next();
};
+
+/**
+ * Listen for connections.
+ *
+ * This method takes the same arguments
+ * as node's `http.Server#listen()`.
+ *
+ * @return {http.Server}
+ * @api public
+ */
+
+app.listen = function(){
+ var server = http.createServer(this);
+ return server.listen.apply(server, arguments);
+};
View
18 test/app.listen.js
@@ -0,0 +1,18 @@
+
+var connect = require('../');
+
+describe('app.listen()', function(){
+ it('should wrap in an http.Server', function(done){
+ var app = connect();
+
+ app.use(function(req, res){
+ res.end();
+ });
+
+ app.listen(5555, function(){
+ app
+ .request('/')
+ .expect(200, done);
+ });
+ })
+})
Please sign in to comment.
Something went wrong with that request. Please try again.