I have a rather specific question:
I have a variable (a constructed filename to be specific) that I'm needing to get from within an API in one file to be stored as a variable in another file. The way my code is set up, there's not really a way (that I can think of) to get this variable from one file to another without using globals. I've been looking around at a few different methods and decided to create a globals module.
Here's the code within my globals module (globals.js):
var globals = {
'new_img': ''
}
module.exports = globals;
I've written:
var globals = require('./public/js/globals');
in my server.js and in my routes.js so that all of my API's and controllers have access to this module.
Now, my actual question: When I serve this web application and multiple people have their own instances of the webpage, will they all be using the same globals module? This is NOT my desired effect, and so I'm wondering if anyone else has any better ways of going about this?
Thanks in advanced!
via Ronald Duquette
No comments:
Post a Comment