0.0.5 • Published 8 years ago

@c8/base-service v0.0.5

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

base-service

A base service package that implements Base Model on the service layer

What it does

Adds base model instance in the service exposing it for use.

Installation

npm install @c8/base-service

Examples

BaseService requires a valid model instance to be passed in the constructor Throws Must pass a valid initialized base model instance Error if no valid BaseModel instance passed Exposes this.model property.

// my-service/index.js

const MyModel = require('../models/my-model')
const BaseService = require('@c8/base-service')

class MyService extends BaseService {

}

module.exports = new MyService(MyModel)

In case you need to extend the service:

class MyService extends BaseService {

    static insert(clause) {
        return this.model.insert(clause)
    }
}

NOTE: The methods you call with this.model.{method}() when extending the base service HAVE to be defined in your model.

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago