How to use the seneca.use function in seneca

To help you get started, we’ve selected a few seneca examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BarnesFoundation / barnes-tms-extract / src / csv_viewer / src / csv-pin-service.js View on Github external
const argv = require('minimist')(process.argv.slice(2));

const d = argv.d;

require('seneca')()

  .use('csv', { d })

  // listen for role:math messages
  // IMPORTANT: must match client
  .listen({ type: 'tcp', pin: 'role:csv', port: 10202 });
github senecajs / seneca-transport / test / stubs / service-foo.js View on Github external
'use strict'

var type = process.argv[2]
console.log('TYPE:' + type)

require('seneca')()
  .use('../transport.js')
  .use('foo')
  .listen({type: type})
github senecajs / ramanujan / docker / post / post-service.js View on Github external
var HOST = process.env.HOST || process.argv[2] || '127.0.0.1'
var BASES = (process.env.BASES || process.argv[3] || '').split(',')

require('seneca')({
  tag: 'post',
  internal: {logger: require('seneca-demo-logger')},
  debug: { short_logs: true }
})
  //.use('zipkin-tracer', {sampling:1})
  .use('entity')
  .use('post-logic')

  .use('mesh',{
    pin: 'post:*',
      bases: BASES,
      host: HOST
  })

  .ready(function(){
    console.log(this.id)
github senecajs / ramanujan / index / index-service.js View on Github external
var HOST = process.env.HOST || process.argv[2] || '127.0.0.1'
var BASES = (process.env.BASES || process.argv[3] || '').split(',')
var SILENT = process.env.SILENT || process.argv[4] || 'true'


require('seneca')({
  tag: 'index',
  internal: {logger: require('seneca-demo-logger')},
  debug: {short_logs: true}
})
    //.use('zipkin-tracer', {sampling:1})

  .use('index-logic')

  .add('info:entry', function(msg,done){
    delete msg.info
    this.act('search:insert',msg,done)
  })

  .use('mesh',{
    listen:[
      {pin: 'search:*'},
github senecajs / seneca-mesh / valid / a-base.js View on Github external
require('seneca')({tag:'base'})
  //.test('print')
  .use('seneca-repl')
  .use('..',{
    base:true,
    monitor:true
  })
github senecajs / ramanujan / timeline / timeline-service.js View on Github external
var SHARD = process.env.SHARD || process.argv[2] || 0
var HOST = process.env.HOST || process.argv[3] || '127.0.0.1'
var BASES = (process.env.BASES || process.argv[4] || '').split(',')
var SILENT = process.env.SILENT || process.argv[5] || 'true'

require('seneca')({
  tag: 'timeline'+SHARD,
  internal: {logger: require('seneca-demo-logger')},
  debug: {short_logs:true}
})
  .use('zipkin-tracer', {sampling:1})
  .use('entity')
  .use('timeline-logic')
  .use('mesh',{
    pin: 'timeline:*,shard:'+SHARD,
    bases: BASES,
    host: HOST,
    sneeze: {
      silent:JSON.parse(SILENT),
      swim: {interval: 1111}
    }
  })
github senecajs / ramanujan / fanout / fanout-service.js View on Github external
var HOST = process.env.HOST || process.argv[2] || '127.0.0.1'
var BASES = (process.env.BASES || process.argv[3] || '').split(',')
var SILENT = process.env.SILENT || process.argv[4] || 'true'

require('seneca')({
  tag: 'fanout',
  internal: {logger: require('seneca-demo-logger')},
  debug: {short_logs: true}
})
    //.use('zipkin-tracer', {sampling:1})
  .use('fanout-logic')

  .add('info:entry', function(msg,done){
    delete msg.info
    this.act('fanout:entry',msg,done)
  })

  .use('mesh',{
    listen:[
      {pin: 'fanout:*'},
      {pin: 'info:entry', model:'observe'}
github BarnesFoundation / barnes-tms-extract / src / image-processing / src / service / images-pin-service.js View on Github external
require('seneca')()
  .use('./imagesPluginAPI.js')
  .listen({ type: 'tcp', pin: 'role:images', port: 10204, timeout: 60000 });
github rjrodger / seneca-examples / micro-services / services / user-details.js View on Github external
require('seneca')()
  .use('user')
  .listen(10201)
  .ready(function(){
    this.act({role:'user',cmd:'register',nick:'u1',name:'U1',password:'u1'})
  })
github senecajs-attic / getting-started / app.js View on Github external
var seneca = require( 'seneca' )()
      .use( 'api' )
      .client( { type:'tcp', pin:'role:math' } )

var app = require( 'express' )()
      .use( require('body-parser').json() )
      .use( seneca.export( 'web' ) )
      .listen(3000)

seneca

A Microservices Framework for Node.js

MIT
Latest version published 5 months ago

Package Health Score

70 / 100
Full package analysis