From 909d5f12d593aa980c81631e78c112c6014b8b8c Mon Sep 17 00:00:00 2001 From: Brian Giometti <76437757+ductilestudios@users.noreply.github.com> Date: Sun, 29 Aug 2021 14:27:52 -0500 Subject: [PATCH] fix: add default listen port for server (#235) * Add default listen port * revise listener as requested * Revised listener as requested Added a space to console log --- server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 5b7619f..0db9923 100644 --- a/server.js +++ b/server.js @@ -53,7 +53,8 @@ app.use(function(err, req, res, next) { } }) -app.listen(process.env.PORT, function () { - console.log('Node.js listening ...'); +//Listen on port set in environment variable or default to 3000 +const listener = app.listen(process.env.PORT || 3000, function () { + console.log("Node.js listening on port " + listener.address().port); });