0.1.3 • Published 5 years ago
@microhq/node-client v0.1.3
Micro Node Client
This package can be used to call any service on Micro.
Please also check the typesafe autogenerated APIs for your Micro services, you might find them more pleasant to use.
Installation:
npm install --save @microhq/node-client
Usage
const { Client } = require("@microhq/node-client");
new Client().call("go.micro.srv.greeter", "Say.Hello", {"name": "John"}).then(response => {
console.log(response)
})
The output will be:
{ msg: 'Hello John' }
You can also connect to your local micro installation:
new Client({local: true})
If you want to change the address, assuming you run the client api:
new Client({address: "https://api.mydomain.com/client"})