Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 26, 2020 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/602dddcf65cc8490b7a87db392413b14 to your computer and use it in GitHub Desktop.
Save velotiotech/602dddcf65cc8490b7a87db392413b14 to your computer and use it in GitHub Desktop.
const https = require('https')
let url = "https://google.com"
exports.handler = async function(event) {
const promise = new Promise(function(resolve, reject) {
console.log("Processing URL: "url)
https.get(url, (res) => {
resolve(res.statusCode)
// console for debugging / testing purpose.
console.info("Request was successfull!!!")
}).on('error', (e) => {
reject(Error(e))
// console for errors
console.error("Error while processing:" + e)
})
})
return promise
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment