Skip to content

Commit

Permalink
ADD: Implemented webhooks config as mentioned in issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
jens.kristian.hoel committed Sep 6, 2019
1 parent 38494a0 commit 3d6d9c2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions config/webhooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** USE THIS FILE TO CONFIGURE WEBHOOKS FUNCTIONALITY
*
* Each webhook should have a descriptive key, with a function as its value. This function
* can then be referenced in the routes, triggering the webhook on updates.
*
*/

module.exports = {
POST_NEW_EVENT: (req) => {
const { id, name, date } = req.body;
const url = `www.someService.com/events/new?id=${id}&name=${name}&date=${date}`

return new Promise((resolve) => {
// TODO - Make the request to the url
resolve(true) // or some other result
})
},
SOME_OTHER_HOOK: () => null,
}

0 comments on commit 3d6d9c2

Please sign in to comment.