Skip to content

Instantly share code, notes, and snippets.

@v9n
Created April 11, 2021 00:29
Show Gist options
  • Save v9n/087eee1e22438e822835d5cb47ad7e1e to your computer and use it in GitHub Desktop.
Save v9n/087eee1e22438e822835d5cb47ad7e1e to your computer and use it in GitHub Desktop.
hanami webhook demo
const express = require('express');
const app = express();
const port = 4443;
app.use(express.json()); //Used to parse JSON bodies
// HANAMI added this
app.use(express.urlencoded({extended:false})); //Parse URL-encoded bodies
app.get('/', (req, res) => {
console.log('Hello world, this is a processing test server');
res.send('Request successfully recevied by webhook');
})
app.post('/', (req, res) => {
console.log("Request intercepted by Hamani. Request body: ", req.body);
// HANAMI added this
console.log("YOUR EMAIL is in", JSON.parse(req.body.email));
res.status(200).send('Request successfully recevied by webhook');
});
app.listen(port, () => {
console.log(`Example app listening on port ${port}`);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment