Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@weave-js/core

0.7.0-rc.23 • Public • Published

NPM Version Build Status CodeFactor Dependencies Downloads

Weave is a fast and easy to use microservice framework for NodeJS.

Features

  • No master/leader node
  • Pluggable transporters (NATS, Redis)
  • Automatic service discovery
  • Multiple services per node
  • Service mixins
  • Request-reply concept
  • Event bus system
  • Middleware support for brokers
  • Load balanced requests (round-robin, random)
  • Distributed timeout handling with fallback response
  • Health monitoring, metrics & statistics
  • Logging system with multiple configurable writable streams
  • Fault tolerant

Installation

$ npm install @weave-js/core --save

Quick start

This example shows you how to create a math service with an add action which can add two numbers.

const { Weave } = require('@weave-js/core')
 
const broker = Weave({
    logger: {
        logLevel: 'debug'
    }
})
 
broker.createService({
    name: 'math',
    actions: {
        add(context) {
            return Number(context.params.a) + Number(context.params.b)
        }
    }
});
 
broker.start()
    .then(() => {
        // Call service
        broker.call('math.add', { a: 5, b: 3 })
            .then(result => console.log('5 + 3 =', result))
            .catch(error => console.error(`Something went wrong! ${error.message}`))
    })
 

Sample applications

There are a number of sample applications available:

    // todo

Documentation

See documentation.

Changelog

See changelog.md.

Roadmap

See roadmap.md.

Documentation

Refer to the Weave CLI documentation for more details.

License

Copyright (c) 2019 by Fachwerk Software

Licensed under the MIT license.

Install

npm i @weave-js/core

DownloadsWeekly Downloads

41

Version

0.7.0-rc.23

License

MIT

Unpacked Size

237 kB

Total Files

100

Last publish

Collaborators

  • avatar