pcb-direct

Direct adapter for PCB. Passthrough to `pcb.call()`, with the difference of it returning `ctx.response`, instead of `ctx`.


Keywords
pcb, adapter, direct, api
License
MIT
Install
npm install pcb-direct@1.1.2

Documentation

pcb-direct

Direct adapter for PCB. Passthrough to pcb.call(), with the difference of it returning ctx.response, instead of ctx.

import pcbDirect from 'pcb-direct'

// assuming pcb is a set up PCB instance
const localAPI = pcbDirect(pcb, defaultMeta)
// defaultMeta is an optional variable to pass to the call if none is provided

// assuming this is the handler for route name "do/thing"
async function doThingHandler (resource, data) {
  return 'nice' + data
}

const a = await localAPI('/do/thing', 'hey')
a === 'nicehey'