piriz

make webservice calls simple as function call

Usage no npm install needed!

<script type="module">
  import piriz from 'https://cdn.skypack.dev/piriz';
</script>

README

Piriz

Make webservice calls simple as function call

What is this?

Piriz help you to get rid of microservices calls headache and make it simple just like a function call

How can i use it ?

  1. Install using npm
  • npm i -g piriz

Server

  1. start server using piriz command
  • piriz start api.js
// api.js
exports.hello = function() {
  return "Hello World, Im working"
}

Client

  1. connect to server
  2. 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.

Port usage

By default Piriz use port 2679 for passing server info and 2680 for data channel

service name as port

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.

use your custom ports

Also you can use your needed custom ports, to this, check custom port example.

Contribute

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