I have a node.js project using StrongLoop with config.local.json and config.json files containing config key value pairs. In server.js I used the following code to retrieve values for keys:
var loopback = require('loopback');
var app = module.exports = loopback();
var value = app.get('key');
However, in Model remote methods or model hooks, how can I retrieve these config key values there?
The answer is get the already created Loopback application, which has access to the config file, and has loaded it.
var app = require('server.js');
var value = app.get('key');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With