Node.js Chatroom
jonster5 (33)

Does anybody have any Idea how to connect to the correct port?

You are viewing a single comment. View All
Answered by TheDrone7 (560) [earned 5 cycles]
View Answer
TheDrone7 (560)

Don't provide a port number, it will automatically connect to one.

TheDrone7 (560)

@jonster5 nothing, don't pass a port number. For example:-

let listener = app.listen(); 
console.log(`Listening to port number ${listener.address().port}`);
jonster5 (33)

@TheDrone7 What should i put in place of the port number?

jonster5 (33)

@TheDrone7 Great! this worked. Thanks for the help, I'm still learning how to use Node.js and Express

TheDrone7 (560)

@jonster5 you're welcome, please mark my comment as the right answer.