pcb-direct
v1.1.2
Published
Direct adapter for PCB. Passthrough to `pcb.call()`, with the difference of it returning `ctx.response`, instead of `ctx`.
Downloads
1
Readme
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'