Error: connect ECONNREFUSED 127.0.0.1:4000



i need help i cant make it work please.

Hey @rexkyle

Glad to have you as part of the community :trophy:

Can add backticks to the console.log() statement so you can see the full message when the server starts, please?

For example:

console.log(`Server started on POST ${process.env.PORT}....`)

Just want to rule out that it’s not starting up someplace else :smiley:


creating this it will work
i dont understand.

Kinda the reason why I wanted you to change the console log statement as it would have shown the problem :grin:

You’re using PORT as a variable but you haven’t declared it anywhere in the script.

That’s why the request works when you add it as it would resolve the full URL.

Previously, it probably would have started with http://localhost:undefined/.. and you would have seen that, if the console log statement was correctly formatted :grin:

Please how did you later sort this syntax error “Error: connect ECONNREFUSED 127.0.0.1:4000”. Please I encountered same error and yet to get it true. Thanks