@bearer/express
TypeScript icon, indicating that this package has built-in type declarations

1.13.10 • Public • Published

@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

Readme

Keywords

Package Sidebar

Install

npm i @bearer/express

Weekly Downloads

0

Version

1.13.10

License

MIT

Unpacked Size

11.4 kB

Total Files

10

Last publish

Collaborators

  • cfabianski
  • qrczeno
  • bearer-engineering-ci-cd
  • gotbadger