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
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