Javascript – How to run logic the first time a route is accessed in Express.js?
I'm using Express.js, and I want to initialize a cache on every initial request to a route, and on the subsequent ones use the cached value. For now, I do something like this: let hasRun = false; app.get('/my-route', async (req,…