1.0.1 • Published 7 years ago

kenote-mount v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

kenote-mount

mount the directory into an alias

NPM Version NPM Downloads Build Status Codecov Status dependencies Status Gratipay

Install

npm install --save kenote-mount

Usage

// mounts

const path = require('path')
const { mounts } = require('kenote-mount')
const { userProxy, bookProxy } = mounts(path.resolve(__dirname, 'proxys'), 'Proxy')

userProxy.login(...)
bookProxy.find(...)

// loadModel

const mongoose = require('mongoose')
const MongooseDao = require('mongoosedao')
const { loadModel } = require('kenote-mount')
const Schema = mongoose.Schema

function getMongooseDao (definition, name) {
  let schema = new Schema(definition)
  let model = mongoose.model(name, schema)
  return new MongooseDao(model)
}

module.exports = loadModel(__dirname, getMongooseDao)

License

this repo is released under the MIT License.