MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / loadDataSource

Function loadDataSource

packages/cli/lib/model-discoverer.js:46–51  ·  view source on GitHub ↗

* Loads a DataSource from a file * If the path provided is a JSON, it instantiates a juggler.DataSource with the config as the only argument * Else it requires it like a compiled loopback datasource * @param modulePath * @returns juggler.DataSource

(modulePath)

Source from the content-addressed store, hash-verified

44 * @returns juggler.DataSource
45 */
46function loadDataSource(modulePath) {
47 const ds = require(modulePath);
48 const key = Object.keys(ds)[0];
49 const val = new ds[key]();
50 return val;
51}
52
53/**
54 * Loads a compiled loopback datasource by name

Callers 1

loadDataSourceByNameFunction · 0.85

Calls 1

keysMethod · 0.65

Tested by

no test coverage detected