1.0.11 • Published 7 years ago

mostly-node v1.0.11

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

MostlyJS Microservice on Node.js

Build Status

MostlyJS is a toolkit to develop distributed microservices in a mostly simple way. It uses NATS as the internal communication system for both service discovery and load balancing. NATS is fast and reliable, and is able to handle millions of request per second.

MostlyJS is targeting breaking current Monolith API application into small services that running on the network transparent to you without knowing where the service physical located.

It provides well integration with existing node frameworks so that you can change a few code to convert your RESTfull api into microservices.

Integration with Koa and Hapi is also planned.

Usage

Installation

1. Install Mostly-node and NATS driver

npm install nats
npm install mostly-node

2. Install and Run NATS Server

https://nats.io/documentation/tutorials/gnatsd-install

Quick Example

var mostly = require('mostly-node')()

// register the service
mostly.add({topic: 'sample', cmd: 'math'}, function (msg, done) {
  var rate  = 0.13;
  var total = msg.foo * (1 + rate);
  done(null, {total: total});
});

// call the service
mostly.act({topic: 'sample', cmd: 'math', foo: 100}, function (err, result) {
  console.log(result.total);
});

License

MIT

1.0.11

7 years ago

1.0.10

7 years ago

1.0.7

7 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago