ship-hold-model-loader
v1.0.0
Published
load ship hold model from a given repository based on a convention
Downloads
3
Maintainers
Readme
ship-hold-models-loader
load ship-hold models based on convention
install
npm install ship-hold-models-loader
usage
assuming you have
.
|
|---models
| |----Users.js
| |----Products.js
Users.js and Products.js following the regular ship-hold model definition pattern
module.exports = function (h){
return {
table:'users',
columns:{},
relations:{}
};
};
then use ship-hold-models-loader
const sh = require('ship-hold')(/* options */)
const models = require('ship-hold-models-loader')(sh) // can pass options here
models.Products === sh.model('Products'); // true
options to path the factory
- folder: the folder to read through to find the model files (default './models')
- exclude: an array of file to exclude (default empty array)