Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
'use strict';
const http = require('https');
// Forward the button press onto our Heroku app
// as a POST request with a JSON body.
exports.handler = (event, context, callback) => {
const params = {
serialNumber: event.serialNumber,
event: event
const postData = JSON.stringify(params);
const req = http.request({
hostname: '',
port: 443,
path: '/button-presses',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(postData)
}, (res) => {
res.on('end', function() {
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.