Microservices the simplest way conceivable.
Create a microservice:
const servify = ;// The service statelet count = 0;// Starts a microservice with 3 API methodsservify
Call a microservice from code:
const servify = ;// Builds the API interface from an URLconst api = servify;// Calls API methods like normal lib functionsapi;api;api;
Call a microservice from the browser / request:
Just access the url followed by ahttp://localhost:3000/concat([1,2], [3,4])http://localhost:3000/count()
This requires ES6 Proxy support, so you need node.js 6 and up. Proxies cannot be polyfilled in earlier versions.
When all you want is to create a microservice, Express.js becomes annoyingly verbose. You have to worry about things like serializing/deserializing JSON, chosing how to format query/param inputs, picking a XHR lib on the client and so on. Servify is a ridiculously thin (50 LOC) lib that just standardizes that boring stuff. To create a microservice, all you need is an object of functions specifying your API. To interact with a service, all you need is its URL. You can then call its functions exactly like you would call a normal lib (except it returns a Promise, obviously).