From 6d6442c4c3627c199459eab7039cacc64d386d6d Mon Sep 17 00:00:00 2001 From: Alex Wang <13398997+AlexWang-16@users.noreply.github.com> Date: Thu, 24 Aug 2023 23:32:37 -0400 Subject: [PATCH] Resolves ACloudGuru-Resources /course-aws-certified-developer-associate#20: Add support for NodeJS v18 compatible code for creating-a-lambda-function-using-the-aws-console lesson --- .../index.js | 10 ---------- .../nodejs-v16-index.js | 12 ++++++++++++ .../nodejs-v18-index.js | 12 ++++++++++++ 3 files changed, 24 insertions(+), 10 deletions(-) delete mode 100644 creating-a-lambda-function-using-the-aws-console/index.js create mode 100644 creating-a-lambda-function-using-the-aws-console/nodejs-v16-index.js create mode 100644 creating-a-lambda-function-using-the-aws-console/nodejs-v18-index.js diff --git a/creating-a-lambda-function-using-the-aws-console/index.js b/creating-a-lambda-function-using-the-aws-console/index.js deleted file mode 100644 index 126c01f..0000000 --- a/creating-a-lambda-function-using-the-aws-console/index.js +++ /dev/null @@ -1,10 +0,0 @@ -const https = require('https') -let url = "https://www.amazon.com" - -exports.handler = function(event, context, callback) { - https.get(url, (res) => { - callback(null, res.statusCode) - }).on('error', (e) => { - callback(Error(e)) - }) -} \ No newline at end of file diff --git a/creating-a-lambda-function-using-the-aws-console/nodejs-v16-index.js b/creating-a-lambda-function-using-the-aws-console/nodejs-v16-index.js new file mode 100644 index 0000000..53fa8f5 --- /dev/null +++ b/creating-a-lambda-function-using-the-aws-console/nodejs-v16-index.js @@ -0,0 +1,12 @@ +const https = require("https"); +let url = "https://www.amazon.com"; + +exports.handler = function (event, context, callback) { + https + .get(url, (res) => { + callback(null, res.statusCode); + }) + .on("error", (e) => { + callback(Error(e)); + }); +}; diff --git a/creating-a-lambda-function-using-the-aws-console/nodejs-v18-index.js b/creating-a-lambda-function-using-the-aws-console/nodejs-v18-index.js new file mode 100644 index 0000000..d2000fc --- /dev/null +++ b/creating-a-lambda-function-using-the-aws-console/nodejs-v18-index.js @@ -0,0 +1,12 @@ +import https from "node:https"; +let url = "https://www.amazon.com"; + +export function handler(event, context, callback) { + https + .get(url, (res) => { + callback(null, res.statusCode); + }) + .on("error", (e) => { + callback(Error(e)); + }); +}