As with any software, here you can expect the unexpected. Node apps experience errors as well. Let’s say that an error crops in our Node API – what should we do about it?
When your app requires users to be using the
https protocol to make requests and get responses, it’s helpful to have an automatic redirect so the user is always in the right place. Here’s how to do that for a Node Express app on Heroku.
A few routes in a NodeJs app – no problem. Just put them in your
app.js. More than a handful? You’ll probably want to look at organizing your routes a different way. This will help keep your core
app.js clean and make your actual routes easier to find.