Skip to content

Instantly share code, notes, and snippets.

@sintaxi sintaxi/webhook.md
Created May 13, 2016

Embed
What would you like to do?
webhook for surge

Example of a webhook server:

var http = require('http')
var express    = require('express')
var bodyParser = require('body-parser')

var app = express()

// parses application/json
app.use(bodyParser.json())

app.use(function (req, res, next) {
  console.log(req.body) // output hook data!
  next()
})

http.createServer(app).listen(1337)
console.log('Server running at http://example.com:1337/')

Test your webhook server:

curl -H "Content-Type: application/json" -X POST -d '{"hello":"world"}' http://example.com:1337
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.