Weave is a fast and easy to use microservice framework for node.js.
- No master/leader node
- Pluggable transporters (TCP, 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
$ npm install @weave-js/core
$ yarn add @weave-js/core
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({
nodeId: 'my-first-node'
})
broker.createService({
name: 'math',
actions: {
add(context) {
return Number(context.data.a) + Number(context.data.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}`))
})
There are a number of sample applications available:
// todo
See documentation.
See changelog.md.
See roadmap.md.
Refer to the Weave CLI documentation for more details.
Copyright (c) 2020 by Fachwerk Software
Licensed under the MIT license.