@bearer/express
Express webhook middleware
Last updated a year ago by cfabianski .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @bearer/express 
SYNC missed versions from official npm registry.

@bearer/express

Version npm bundle size (scoped) Downloads/week NPM

TODO: description

Usage

Get your Bearer's credentials and setup Bearer as follow:

// your server.ts
import express from 'express'
import bearerWebhooks from '@bearer/express'

const app = express()

// each value must be a function returning a promise
const webhookHandlers = {
  ['INTEGRATION_UUID']: req =>
    new Promise(() => {
      // you logic goes here
      if (something) resolve()
      else {
        reject()
      }
    }),
  // With ASync
  ['INTEGRATION_UUID']: async req => {
    // you logic goes here
    // ex: console.log(req.body)
    const reponse = await somethingYouWantToWaitFor
    if (response.success) {
      return whatever
    } else {
      throw new Error('An error occured')
    }
  }
}

app.use('/webhooks', bearerWebhooks(webhookHandlers, { token: 'ENCRYPTION_KEY' })) // Copy and Paste you Encryption Key

Current Tags

  • 1.7.1-canary.2                                ...           canary (a year ago)
  • 1.13.10                                ...           latest (9 months ago)
  • 2.0.0                                ...           next (9 months ago)
  • 0.115.1                                ...           rc (a year ago)

20 Versions

  • 2.0.0                                ...           9 months ago
  • 1.13.10                                ...           9 months ago
  • 1.13.9                                ...           9 months ago
  • 1.13.8                                ...           9 months ago
  • 1.13.4                                ...           9 months ago
  • 1.8.0                                ...           a year ago
  • 1.7.1-canary.2                                ...           a year ago
  • 1.8.0-canary.2                                ...           a year ago
  • 1.7.0                                ...           a year ago
  • 1.6.8                                ...           a year ago
  • 1.6.2-canary-4.1                                ...           a year ago
  • 1.6.1                                ...           a year ago
  • 1.4.2-canary.17 [deprecated]           ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.115.1 [deprecated]           ...           a year ago
  • 0.115.0 [deprecated]           ...           a year ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |