Railway error
I decided to host my website(made on express.js) on railway. But i get Error: Cannot find module './models/product'. Even if it works on localhost
How directory looks
Why this is happening ? And how can i fix it ?
But this wont happen on localhost. And no matter how i
ll try to change path to index.js it won`t work.
The problem was when choosing the PORT
to connect. Railway.com hosting needs an .env
variable to choose which port to use.
I hadn't written this, so hosting returned an error. This is how it was resolved:
app.listen(process.env.PORT || 3000, () => {
console.log("On work")
})