Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@bearer/express

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

Install

npm i @bearer/express

DownloadsWeekly Downloads

2

Version

1.13.10

License

MIT

Unpacked Size

11.4 kB

Total Files

10

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar