Skip to content

Commit a70a923

Browse files
committed
Start app on free port
1 parent 4c2ef8e commit a70a923

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ app.get('/style1.css', function (req, res) {
7979
}, 20000);
8080
});
8181

82-
app.listen(3000, function () {
83-
console.log('Example app listening on port 3000!');
82+
const listener = app.listen(0, function () {
83+
console.log(`Example app listening on port ${listener.address().port}
84+
http://localhost:${listener.address().port}`);
8485
});

0 commit comments

Comments
 (0)