New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

node-gitlab-webhook

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-gitlab-webhook

Gitlab Webhooks handler based on Node.js. Support multiple handlers.

latest
Source
npmnpm
Version
1.0.6
Version published
Weekly downloads
9
-70%
Maintainers
1
Weekly downloads
 
Created
Source

node-gitlab-webhook

Gitlab Webhooks handler based on Node.js. Support multiple handlers.

Language

  • 中文

Instructions

This library is modified for Gitlab, Github version here: node-github-webhook.

If you want to know the settings of Gitlab webhooks, please see: gitlab webhooks.

Installation

npm install node-gitlab-webhook --save

Usage

var http = require('http')
var createHandler = require('node-gitlab-webhook')
var handler = createHandler([ // multiple handlers
  { path: '/webhook1', secret: 'secret1' },
  { path: '/webhook2', secret: 'secret2' }
])
// var handler = createHandler({ path: '/webhook1', secret: 'secret1' }) // single handler

http.createServer(function (req, res) {
  handler(req, res, function (err) {
    res.statusCode = 404
    res.end('no such location')
  })
}).listen(7777)

handler.on('error', function (err) {
  console.error('Error:', err.message)
})

handler.on('push', function (event) {
  console.log(
    'Received a push event for %s to %s',
    event.payload.repository.name,
    event.payload.ref
  )
  switch (event.path) {
    case '/webhook1':
      // do sth about webhook1
      break
    case '/webhook2':
      // do sth about webhook2
      break
    default:
      // do sth else or nothing
      break
  }
})

Keywords

Gitlab

FAQs

Package last updated on 10 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts