node.jsarraysstoragestoring-data

Data in an array on a NodeJs server


I have an array on the node js server file which holds some static data which will be used again and again. My question is, will that data remain the same for all the users or every user will get an empty array at first?

I am guessing that the array will be the same for all the users since it's on the server and the server will not change


Solution

  • If you're just storing the array in a regular old variable and your server inspects that variable for every request, then all users will see the same data.