I need to store a token in memory that can be reused by each render. I tried something like this with a custom module but it's being reset on every render.
const state = require('src/state.js');
async function beforeRender(req, res) {
// should be not null on the second render
if(!state.getToken()){
const token = await login();
state.setToken(token)
}
// use token...
}