1.2.0 • Published 5 years ago

simple-nats-rpc v1.2.0

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

NATS RPC

Simple RPC via NATS

Example

server.ts

import { createServer } from 'simple-nats-rpc'

const functions = {
  add: (a, b) => a + b,
  subtract: (a, b) => b - a
}

createServer({ payload: Payload.JSON }, functions)

client.ts

import { createClient } from 'simple-nats-rpc'

const client = await createClient({ payload: Payload.JSON })

const result = await client.request('add', [1, 2], { timeout: 1000 })
// => 3

const result2 = await client.request('subtract', [5, 10])
// => 5
1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago