I know this has been asked a few times but I haven't been able to find a solution that works yet. I'm trying to have my node server deployed on Heroku and build succeeds but the log prints the following message. I'm also using mongoose and have no problem deploying locally.
2019-02-10T22:30:09.912634+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=chatifydotcom.herokuapp.com request_id=b486e511-ff21-4166-ae1d-07bf5796691e fwd="74.196.2.211" dyno= connect= service= status=503 bytes= protocol=https
2019-02-10T22:30:10.287542+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=chatifydotcom.herokuapp.com request_id=18f17ca0-56df-4dfe-a560-d890a699f17f fwd="74.196.2.211" dyno= connect= service= status=503 bytes= protocol=https
Server.js
const uri = process.env.MONGODB_URI || "mongodb://localhost:27017/chat"
mongoose
.connect(uri, { useNewUrlParser: true })
.then(() => console.log("MongoDB Connected"))
.catch(err => console.log(err.message))
const port = process.env.PORT || 9000
server.listen(port, () => {
console.log(`This server is over ${port}`)
})