Skip to content

Instantly share code, notes, and snippets.

@sintaxi
Created May 13, 2016 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sintaxi/c3a35b9a64b2461c6df69b8587c2a48f to your computer and use it in GitHub Desktop.
Save sintaxi/c3a35b9a64b2461c6df69b8587c2a48f to your computer and use it in GitHub Desktop.
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