micro-handler
v1.0.0
Published
Module for quick start with microservice structure.
Downloads
5
Readme
Mircoservice handler
Module for quick start with microservice structure.
- loads all installed microsservices
- exposes REST methods
- easy to configure
Installation
$ npm install micro-handler --save
Usage
Just require handler and pass directory of microservices.
const MH = require('micro-handler')('microservices/');
When calling REST methods, micro-handler will return promise.
To use REST interface from all loaded microservices, call its "folder-name":
MH.{nameOfMicroservice}.{method}('{route}', {someParams: optionally}, {override: optionally});
For example... Calling POST method on mail microservice to send email with some title:
MH.mail.post('/send', {title: 'some title'});
Port is automatically parsed from microservice configuration, but you can override any params using ovveride object like:
MH.mail.post('/send', {title: 'some title'}, {port: 1337});
Todos
- Remove GOT dependency, use native HTTP