Sharing a variable between server.js and client.js


Somehow sharing variables between server.js and client.js. So that if one change it, it changes for the other one as soon as it requires it again. If you could write to a json somehow and then read from it everytime it might work.


You should start looking at sessions to start this up, then output the required variables based on xhr requests from the sessioned user. on clientside you should do some interval that xhr’s/fetches these variables. I’m using express-session which is pretty gud and should work here