0.0.7 • Published 8 years ago

seneca-service-area v0.0.7

Weekly downloads
1
License
MIT
Repository
-
Last release
8 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

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

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