From 614da1049b9558bf052fcf7a2a9e2b3e002997e1 Mon Sep 17 00:00:00 2001 From: Geng Tan Date: Sat, 23 Apr 2022 23:57:13 -0400 Subject: [PATCH 1/4] feature/turkey-fixes --- app.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 6cf6dbc..2c30566 100644 --- a/app.js +++ b/app.js @@ -8,8 +8,7 @@ const app = express(); // }); app.get("/thumbnail/:b64url", function(req, res) { - console.log(req.url); - console.log(req.query); + console.log("req",req); lambda.handler( { @@ -20,7 +19,8 @@ app.get("/thumbnail/:b64url", function(req, res) { }, null, async function(something, callback) { - console.log("callback: ", callback); + console.log("callback: ", callback.statusCode, callback.headers); + res.removeHeader("Content-Type") res .status(callback.statusCode) .header(callback.headers) @@ -41,7 +41,8 @@ app.get("/thumbnail", function(req, res) { }, null, async function(something, callback) { - console.log("callback: ", callback); + console.log("callback: ", callback.statusCode, callback.headers); + res.removeHeader("Content-Type") res .status(callback.statusCode) .header(callback.headers) From 93b65e9a8ad7138a596eddc3ea660eb8d733184f Mon Sep 17 00:00:00 2001 From: Geng Tan Date: Sun, 24 Apr 2022 00:04:12 -0400 Subject: [PATCH 2/4] updates for turkey --- app.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app.js b/app.js index 2c30566..403abf9 100644 --- a/app.js +++ b/app.js @@ -8,7 +8,7 @@ const app = express(); // }); app.get("/thumbnail/:b64url", function(req, res) { - console.log("req",req); + console.log("req.url",req.url); lambda.handler( { @@ -20,17 +20,15 @@ app.get("/thumbnail/:b64url", function(req, res) { null, async function(something, callback) { console.log("callback: ", callback.statusCode, callback.headers); - res.removeHeader("Content-Type") res .status(callback.statusCode) .header(callback.headers) - .send(callback.body); + .body(callback.body) } ); }); app.get("/thumbnail", function(req, res) { - console.log(req.url); - console.log(req.query); + console.log("req.url",req.url); lambda.handler( { @@ -42,11 +40,10 @@ app.get("/thumbnail", function(req, res) { null, async function(something, callback) { console.log("callback: ", callback.statusCode, callback.headers); - res.removeHeader("Content-Type") res .status(callback.statusCode) .header(callback.headers) - .send(callback.body); + .body(callback.body) } ); }); From ea9cb873eebb4235ce6ebd601d747e3053952482 Mon Sep 17 00:00:00 2001 From: Geng Tan Date: Sun, 24 Apr 2022 00:06:58 -0400 Subject: [PATCH 3/4] updates for turkey --- app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 403abf9..ae5316a 100644 --- a/app.js +++ b/app.js @@ -23,7 +23,7 @@ app.get("/thumbnail/:b64url", function(req, res) { res .status(callback.statusCode) .header(callback.headers) - .body(callback.body) + .send(callback.body) } ); }); @@ -43,7 +43,7 @@ app.get("/thumbnail", function(req, res) { res .status(callback.statusCode) .header(callback.headers) - .body(callback.body) + .send(callback.body) } ); }); From bad7a9cc4e9d761125a20d8604ca36316e4dc22f Mon Sep 17 00:00:00 2001 From: Geng Tan Date: Sun, 24 Apr 2022 00:24:25 -0400 Subject: [PATCH 4/4] updates for turkey --- app.js | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/app.js b/app.js index ae5316a..fa9ee18 100644 --- a/app.js +++ b/app.js @@ -20,33 +20,34 @@ app.get("/thumbnail/:b64url", function(req, res) { null, async function(something, callback) { console.log("callback: ", callback.statusCode, callback.headers); - res - .status(callback.statusCode) - .header(callback.headers) - .send(callback.body) - } - ); -}); -app.get("/thumbnail", function(req, res) { - console.log("req.url",req.url); - lambda.handler( - { - queryStringParameters: req.query, - pathParameters: { - url: req.url.replace("/thumbnail", "") - } - }, - null, - async function(something, callback) { - console.log("callback: ", callback.statusCode, callback.headers); res .status(callback.statusCode) .header(callback.headers) - .send(callback.body) + .send(Buffer.from(callback.body, 'base64')) } ); }); +// app.get("/thumbnail", function(req, res) { +// console.log("req.url",req.url); + +// lambda.handler( +// { +// queryStringParameters: req.query, +// pathParameters: { +// url: req.url.replace("/thumbnail", "") +// } +// }, +// null, +// async function(something, callback) { +// console.log("callback: ", callback.statusCode, callback.headers); +// res +// .status(callback.statusCode) +// .header(callback.headers) +// .send(callback.body) +// } +// ); +// }); app.listen(5000, function() { console.log("listening on :5000"); });