diff --git a/creating-a-lambda-function-using-the-aws-console/index.js b/creating-a-lambda-function-using-the-aws-console/index.js index 289029b..4d7c615 100644 --- a/creating-a-lambda-function-using-the-aws-console/index.js +++ b/creating-a-lambda-function-using-the-aws-console/index.js @@ -1,9 +1,11 @@ -const https = require('https'); -let url = "https://www.amazon.com"; +import https from 'https'; -exports.handler = async function(event) { +const url = "https://www.amazon.com"; + +export const handler = async function(event) { let statusCode; - await new Promise(function(resolve, reject) { + + await new Promise((resolve, reject) => { https.get(url, (res) => { statusCode = res.statusCode; resolve(statusCode); @@ -11,6 +13,7 @@ exports.handler = async function(event) { reject(Error(e)); }); }); + console.log(statusCode); return statusCode; };