hukk
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

hukk

Portable webhook utilities for NodeJS micro-service

npm version Build Status FOSSA Status

Installation

yarn add hukk

Usage

Create webhook server:

import hukk from 'hukk'
 
// Register new hook object
hukk.register({
  endpoint: '/webhook',
  handle: (data) => {
    console.log(data)
  }
}) 
 
hukk.listen(3000, () => {
  console.log('Hook server listening on port 3000')
})

Send hook to another server

import {hukkup} from 'hukk'
 
const data = {bar: 'boo'}
hukkup({hostname: 'localhost', port: 3000, endpoint: '/webhook', data}, (err, data) => {
  if (err) {
    console.error(err)
  }
  console.log('Response: ', data) // {"body": {"bar": "boo"}}
})

License

FOSSA Status

Readme

Keywords

Package Sidebar

Install

npm i hukk

Weekly Downloads

12

Version

1.3.0

License

MIT

Unpacked Size

12 kB

Total Files

8

Last publish

Collaborators

  • nampdn