/unirpc

Universal RPC - An unopinionated RPC barebones framewor

Primary LanguageJavaScriptISC LicenseISC

UNIRPC

An unopinionated RPC barebones framework

Usage:

const unirpc = require('unirpc')
const service = unirpc({
  '*': async (req, res) => {
    console.log('this gets evaluated before anything on this tree')
  },

  method1: async (req, res) => {
    if (req.params.issue) {
      res.ok = true
    } else {
      res.ok = false
    }
  },

  subtree: unirpc(require('./another-file-with-req-res-pattern'))
})

service({method: 'subtree/submethod', params: { test: true } })

License

See LICENSE