Awesome Open Source
Awesome Open Source

Depencies Issues License NPM Version Servious

Servious - Node.js zero-configuration microservices made easy

** Servious is a modern zero configuration microservice library. Absolutely no third party libraries required.**

Servious is still in early beta. Help us out by reporting any bugs.

Your first microservice in 30 seconds.

Installation

npm install servious --save

Example requester.js

import servious from 'servious'

servious.configure(); // Any global config here

// Link this instance with any other services to whom requests will be made
servious.addLink({
  name: 'my-service',
  service: 'my-service', // The service you wish to target with this link
  options: {
    namespace: 'custom-namespace', // Optional namespace
  }
});

// Send a test request to my-service
const req = await servious.send('my-service', 'generate-number', { payload: { 1: Math.round(Math.random(), 2) } });

console.log(req)

Example responder.js

import servious from 'servious'

servious.configure(); // Any global config here

// Register this service as a responder
servious.registerResponder({
  name: 'my-service', // The name of your service
  namespace: 'custom-namespace' // Optional namespace
});

// Add a handler for function "generate-number"
servious.on('generate-number', async (req) => {
  console.log(`Received request ${JSON.stringify(req)}`);
  return Math.random();
});

Further documentation pending


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Javascript (1,513,839
Nodejs (53,975
Microservice (5,900
Microservices Architecture (441
Related Projects