This package is used to spin up a webserver to get POST requests from github webhook.
npm install simple-webhook-github
You can setup a simple webhook like this..
Typescript
importSimpleWebhookfrom"simple-webhook-github";constPort=3000;constwebhook=newSimpleWebhook(Port);webhook.listen("everything",response=>{// Do something})JavaScript
constSimpleWebhook=require("simple-webhook-github").default;constPort=3000;constwebhook=newSimpleWebhook(Port);webhook.listen("everything",response=>{// Do something})You can also use express as an middleware
Typescript
importSimpleWebhookfrom"simple-webhook-github";importExpressfrom"express";constPort=3000;constapp=Express();constwebhook=newSimpleWebhook(app);webhook.listen("everything",response=>{// Do something})app.listen(Port);JavaScript
constSimpleWebhook=require("simple-webhook-github").default;constExpress=require("express");constPort=3000;constapp=Express();constwebhook=newSimpleWebhook(app);webhook.listen("everything",response=>{// Do something})app.listen(Port);...
interfaceOptions{/** * @param endpoint The endpoint for the webserver * @default /webhook */endpoint: string;/** * @param secret The secret from github, needs to equal to each other */secret: string;}
...SimpleWebhook(PortorExpress,Config)The on event includes events that can happen in the webhook, like errors etc.
Typescript
importSimpleWebhookfrom"simple-webhook-github";constPort=3000;constwebhook=newSimpleWebhook(Port);webhook.on("error",(error)=>{console.log(error);})Tolfix is a company focusing about IT, Development and Networking, we drive to help others with their problems when it comes to IT and love contributing to others.
Want to find more information about us you can visit us at https://tolfix.com/.

