Created
April 24, 2017 22:31
-
-
Save aroach/c93bc70edf68becbd65ee09c33365582 to your computer and use it in GitHub Desktop.
Example functions
This file contains hidden or 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
'use strict' | |
var https = require('https'); | |
exports.handler = (context, callback) => { | |
// Add your code here | |
request( | |
{ | |
url: 'https://api.github.com/users/aroach/gists', | |
headers: { | |
'accept': 'application/json', | |
'user-agent': 'ashley-glue' | |
} | |
}, function(error, response, body) { | |
logger.info("Finished"); | |
logger.info("body:", body); | |
logger.info("error:", error); | |
logger.info("response:", response && response.statusCode); | |
// Most likely put your callback() here | |
callback(body); | |
}); | |
}; |
This file contains hidden or 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
'use strict' | |
var https = require('https'); | |
exports.handler = (context, callback) => { | |
// Add your code here | |
callback(JSON.stringify({"result": context[0].url})); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment