0.0.7 • Published 7 years ago

seneca-service-area v0.0.7

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

#Why

Instead of dispatching directly to a service created by seneca().listen and this way be coupled to the existence of a microservice, you just dispatch to the seneca instance available in current service.

#Usage:

var seneca = require('seneca')
var configureDispatching = require('seneca-service-area').configureDispatching

const senecaInstance =
  seneca()
  .use(configureDispatching, {
    user: {
      port: 8082,
      host: 'localhost',
      protocol: 'http'
    },
    email: {
      port: 8081,
      host: 'localhost',
      protocol: 'http'
    }
  })

#What it does

This configures a senecaInstance object to dispatch any commands that match the pattern {area: 'user'}, {area: 'email'} to:

seneca().listen({
    port: 8081,
    host: 'localhost',
    protocol: 'http'
})

It pretty much does the following:

var userService = seneca().listen({
                              port: 8081,
                              host: 'localhost',
                              protocol: 'http'
                          })
providedSenecaInstance.add({area:'user'}, (msg, done) => userService.act(msg, done))
0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago