1.5.1 • Published 4 years ago

seneca-service-loader v1.5.1

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

Seneca

A Seneca.js Structure Plugin

seneca-service-loader

npm version Dependency Status

Lead Maintainer: Tobias Gurtzick

seneca-service-loader

This module is a plugin for the Seneca framework. It provides you with capabilities to cleanly structure your services.

Usage

To use the service-loader first install the module via

npm i -s seneca-service-loader

Now you can require the plugin and use it, like in the following example:

'use strict';

const Service = require('seneca-service-loader');
const seneca = require('seneca');

const service = new Service(seneca);
service
  .register([
    {
      register: require('hapi-mariadb'),
      options: {
        mariasql: config.database,
        connectionCount: 8,
        poolAsPromised: true
      }
    }
  ])
  .then(() => service.load());

Now it will allow you to load any file from lib/controllers/*.js. A service looks like this:

'use strict';

module.exports = {
  pin: 'my:pin,command:name':,
  request: async (request, data) => {
    return null;
  }
}

The example provided here also registers a hapi plugin. Quite simple plugins for hapi do work with this module. Like most database modules. This is intended to produce a better overall experience, by accessing APIs everywhere in the same way.

1.5.1

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago