Make webservice calls simple as function call
Piriz help you to get rid of microservices calls headache and make it simple just like a function call
- Install using npm
npm i -g piriz
- start server using piriz command
piriz start api.js
// api.js
exports.hello = function() {
return "Hello World, Im working"
}
- connect to server
- use your functions
// client.js
const piriz = require("piriz");
const myService = piriz.connect("localhost")
myService.hello().then((res) => {
console.log("Hello result:", res)
})
Thats it! you have connected two microservices just like a function call! for more examples, check complex example.
By default Piriz use port 2679 for passing server info and 2680 for data channel
You can use service name instead of port number, its great for running multiple service on same machine
const service1 = piriz.connect("localhost", "hello")
const service2 = piriz.connect("localhost", "salam")
check service name full example.
using custom port is depricated, you must provide service name, and port will assign and found autmatically
Feel free to open issue or make PR, if you want to join this, i think we need these codes:
- automation tests (make it in ./test/test.js)
- socketio channel (add it in ./src/channel)
- socketio example (add it in ./example)
- docker and docker-compose example (add it in ./example)
- but, its ok to add anything else you need