Skip to content

Commit

Permalink
Return http.Server from express.listen()
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmoodlerooms committed Mar 26, 2014
1 parent cb01abe commit f5b19e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions express/express-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1489,3 +1489,10 @@ function test_middleware() {
app.use(express.static('public'));
app.use(router.middleware);
}

////////////////////

// make sure server can be shut down
var testShutdownServer = app.listen(0);
console.log('listening on port ' + testShutdownServer.address().port);
testShutdownServer.close();
10 changes: 5 additions & 5 deletions express/express.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1112,15 +1112,15 @@ declare module "express" {
* http.createServer(app).listen(80);
* https.createServer({ ... }, app).listen(443);
*/
listen(port: number, hostname: string, backlog: number, callback?: Function): void;
listen(port: number, hostname: string, backlog: number, callback?: Function): http.Server;

listen(port: number, hostname: string, callback?: Function): void;
listen(port: number, hostname: string, callback?: Function): http.Server;

listen(port: number, callback?: Function): void;
listen(port: number, callback?: Function): http.Server;

listen(path: string, callback?: Function): void;
listen(path: string, callback?: Function): http.Server;

listen(handle: any, listeningListener?: Function): void;
listen(handle: any, listeningListener?: Function): http.Server;

route: IRoute;

Expand Down

0 comments on commit f5b19e8

Please sign in to comment.