jordey92
HOBBYOP
2 years ago
Hey, I'm learning a bit about web sockets and followed a tutorial and I wanted to deploy it to test how easy deploying would be as I want to build a proper app in future.
Locally, it works fine running node server.js, but when I deployed it to railway, it errors when I go to the URL created with "Application failed to respond".
In the deployment logs, it shows as successful and I am not sure what I have done wrong:
> node server.js
Listening on: http://localhost:8080I'm not really sure what to look for to find out what is wrong.
4 Replies
2 years ago
You need to listen on the port that railway provides
in your case
const port = process.env.PORT || 8080this will listen on the port railway provides and if that port is not given, it'll default to 8080