> On May 31, 2016, at 10:41, Emerson Luiz <
elu...@gmail.com> wrote:
>
> Aria,
>
> Thanks for your response...
>
> I use MongooseJS, i think his no have method GET.
>
> I need take this variable for all modules in my app.
with mongoose, you'd use `yourModel.find`, since it's an object mapper, not just a plain mongo client. It's got schemas and such that you'd want to use.
It may be useful to you to use some simple injection in your app: instead of modules like so:
module.exports = function thing() {
global.config // used here
}
you may want to do this:
module.exports = function mymodule(config) {
return function thing() {
config // used here
}
}
So your configuration bit can load the rest of your app. Maybe not, but global variables are a smell and it's worth thinking about the order things load in and how easy it is to mess that up.