1.0.0 • Published 8 years ago

ship-hold-model-loader v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

ship-hold-models-loader

CircleCI 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)