I created a Loopback.js application and defined models talking to a datasource. All is ok in Loopback explorer. server.js is working fine. In the /server folder, I created another js file that does contain:
var loopback = require('loopback');
var app = module.exports = loopback();
console.log(app.models());
When running that file, no models are shown.
The result is: []
.
This is an empty array.
Any idea why I cannot get the whole models list?
Thanks and Regards.
let app = require('../../server/server'); /** make sure the path to server is right **/
console.log(app.models)
if you want to access specific model
console.log(app.models.modelName);