So I wanted to try making like a blog website with Node js and MongoDB. I’m a beginner with it so it’s kinda a mess, but everything worked fine locally (on localhost 3000). I found Railway as a free alternative to Heroku and tried to deploy my project there.
For some reason it failed to connect to the database, and this is what I got in the logs.
This error message indicates a local MongoDB server isn’t listening on 0.0.0.0 (all local IPv4 addresses on local machine), port 27017.
By default, a running MongoDB server will only bind to localhost (‘127.0.0.1’), so you could try changing your connection string to use the localhost IP (or localhost hostname) instead.
Alternatively, if your app server is running on a separate host from MongoDB, you could configure your MongoDB process to bind to all IPs. However, please review the MongoDB Security Checklist and configure appropriate security measures before allowing remote access.