How can I create a global variable

how can I create a global variable, where I can start it with an “x” value together with the app and then I can manipulate it in any controllers, without losing its state?

Hello @aldisseia!

You can create global variable like you can create them in Nodejs. Just use global.variableName and it would be clean to put it in simple provider.

It’s rare case tho when global variable is actually good thing to use, usually when you need global variable it means that you have some logical mistake in your application.

Here’s more about global variables: https://stackabuse.com/using-global-variables-in-node-js/

3 Likes