1

I'm trying to use Compound JS and want to load on startup some values from DB and store them in global variables shared across all sessions.

How can I do it?

xaxa
  • 1,057
  • 1
  • 24
  • 53

1 Answers1

2

One way would be to put them in the config/initializers folder.

Example: /config/initializers/settings.js

module.exports = function (compound) {
    compound.models.Setting.all(function (err, settings) {
        compound.settings = settings;
    });
};
absynce
  • 1,399
  • 16
  • 29