Created
July 2, 2018 14:56
-
-
Save charliejllewellyn/663b057f79a68dd752fea49eebfaea64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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