Skip to content

Instantly share code, notes, and snippets.

@charliejllewellyn
Created July 2, 2018 14:56
Show Gist options
  • Save charliejllewellyn/663b057f79a68dd752fea49eebfaea64 to your computer and use it in GitHub Desktop.
Save charliejllewellyn/663b057f79a68dd752fea49eebfaea64 to your computer and use it in GitHub Desktop.
exports.handler = (event, context, callback) => {
// TODO implement
var https = require('https');
var options = {
host: 'bus.miller.cm',
port: 443,
path: '/api/heslington-hall',
method: 'POST'
};
var req = https.request(options, function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
//res.setEncoding('utf8');
res.on('data', function (chunk) {
var obj = JSON.parse(chunk);
console.log('BODY: ' + JSON.stringify(obj.stop));
});
});
req.on('error', function(e) {
console.log('problem with request: ' + e.message);
});
// write data to request body
req.write('data\n');
req.write('data\n');
req.end();
callback(null, 'Hello from Lambda');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment