OverviewFilesCommitsIssuesDocsReleasesPeers

codetree / test / fixtures / workspace / widget-store / lib / handlers / widgets.js

15 lines · javascript ref:
/**
 * The handler-factory pattern: a function returning a map of RPC handlers,
 * standing in for pear-git-v3's lib/handlers/*.js.
 */
export function createWidgetHandlers (ctx) {
  return {
    async list () {
      return ctx.store.list()
    },
    async create (req) {
      return ctx.store.create(req.name, req.type, req.data)
    }
  }
}