I'm working with Next.js and have a single file containing the following code:
export let counter = 0;
In the first API route file /api/test1, I increment the counter by 5 like this:
counter += 5;
In the second API file /api/test2, I try to access the updated value of the counter:
console.log('counter', counter); // 5
However, I keep getting 0 instead;
Is there a way for me to access the current value of the counter in the second file?
p.s. This is a simplified version of my issue, using a counter example.