Node JS application: deployment is succesfull but server error(application failed to respond)
homealankar
HOBBYOP

2 years ago

Cloud please tell me the reason
I have attached snap also FYI

8 Replies

dev
MODERATOR

2 years ago

You need to listen on the port that railway provides
more info:

const port = process.env.PORT || 4000

homealankar
HOBBYOP

2 years ago

So its 3000 not 4000
Is it??


dev
MODERATOR

2 years ago

no, it's random


homealankar
HOBBYOP

2 years ago

app.listen({ port: 4000 }, () =>
console.log(
🚀 Server ready at [http://localhost:4000${server.graphqlPath}](http://localhost:4000${server.graphqlPath}),
),
)
this is how , im passing the port no not in .env


dev
MODERATOR

2 years ago

You need to listen on the port that railway provides
please read this:


dev
MODERATOR

2 years ago

in your case you can get the port by doing:

const port = process.env.PORT || 4000

homealankar
HOBBYOP

2 years ago

sure let me read, thanks


homealankar
HOBBYOP

2 years ago

Can i deploy react js application as well ??


Loading...