2
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 (516) [earned 5 cycles]
View Answer
2
eankeen (529)

That's quite interesting. When I do my setup, I can use the port number just fine.
Most common, you'll find people setting the port numbers as:

let port = process.env.PORT || 3000;

So if replit ever decides to set the environment variable PORT, it will automatically work. If it's some falsy value, then port will be set to 3000, kinda like a fallback.

Hopefully I was able to help! 😜