I’m aware Heroku sleeps apps after 30 mins of inactivity, and that’s fine.
I have a React front-end hosted on Vercel, with an ExpressJS back-end hosted on Heroku, and it’s very likely that the user won’t need to make a MongoDB call (all this server does) within less than the time it takes to "wake up" the server on Heroku. So if when the app loads it were somehow able to "poke" the server to wake it up, most users wouldn’t even know it was sleeping in the first place.
Is this possible without making an intentionally redundant CRUD request?
As per the comment from @jonrsharpe under the question, it appears the simplest and easiest way to do this is to just call
get('/wakeUp') on the initial page load and let it return a 404. Not pretty but it works.
There’s no reason this can’t also return something more meaningful, but apparently it doesn’t need to.
Answered By – benmneb