How do i set a variable in app.js and have it be available in all the routes, atleast in the index.js file located in routes. using the express fra
app.js
index.js
the easiest way is to declare a global variable in your app.js, early on:
global.mySpecialVariable = "something"
then in any routes you can get it:
console.log(mySpecialVariable)