3 ms·
I don’t see the point of that. Your code won’t look like that anyway, change your example to a typical web application backend to see the problem. All you have
by slashdev 3y ago
I don’t see the point of that. Your code won’t look like that anyway, change your example to a typical web application backend to see the problem.
All you have is requests and responses. They don’t come in a predictable order.
Whether you use async/await or not it’s irrelevant.
Loading and restoring the state is trivial. If you just want one state object per user, you can load and save it in your framework middleware. In real life you typically need more state than just per user state, which is why it’s uncommon to see that.
In the end you’ll find yourself back at the typical application server plus database architecture.