0.1.1 • Published 6 years ago

generic-services v0.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

generic-services

This is service which supports defining a business logic on a file. The package follows the Onion Architecture then applicaton-services and service-agents must be defined in advanced.

Usage

const gs = require('generic-services');
const createCustomer = () => {
  const serviceStack = gs.init(__dirname, DbContext, null);
  return serviceStack.execute('case.json', {
    name: 'Antony Nguyen',
    email: 'antony.nguyen0901@gmail.com'
  }).then((rs) => {
    console.log(rs);
  });
};

A use-case file should be a json file as follow:

{
  "name" : "create customer",
  "flow": [{
    "service": "customer-service",
    "module": "crm",
    "funcName": "createCustomer",
    "isInternal": true
  },
  {
    "service": "customer-service",
    "module": "crm",
    "funcName": "checkCustomer",
    "isInternal": true
  },
  {
    "service": "customer-service",
    "module": "crm",
    "funcName": "changeCustomerName",
    "isInternal": true
  }]
}

the Internal prop means the service would be executed in application-services. Otherwise would be called executed in service-agents.

0.1.1

6 years ago

0.1.0

6 years ago