Skip to content

Commit

Permalink
Add Lambda application
Browse files Browse the repository at this point in the history
  • Loading branch information
xsalazar committed Sep 30, 2023
1 parent 687f282 commit 8967fa0
Show file tree
Hide file tree
Showing 4 changed files with 104,257 additions and 0 deletions.
33 changes: 33 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const AWS = require("aws-sdk");
const fs = require("fs");

exports.handler = async (event, context) => {
console.log(JSON.stringify(event));
const bucketName = "xsalazar-emoji-kitchen-data";

if (event.requestContext.http.method === "GET") {
const s3 = new AWS.S3();

const metadata = fs.readFileSync(`./metadata.json`);

try {
return {
cookies: [],
isBase64Encoded: false,
statusCode: 200,
headers: { "content-type": "application/json" },
body: JSON.stringify(JSON.parse(metadata.toString())),
};
} catch (e) {
console.log(JSON.stringify(e, ["name", "message", "stack"]));

return {
cookies: [],
isBase64Encoded: false,
statusCode: 500,
headers: {},
body: "",
};
}
}
};
Loading

0 comments on commit 8967fa0

Please sign in to comment.