From d10fe5f68f172876a6d8ae3089a6603f15ea3e1d Mon Sep 17 00:00:00 2001 From: Matchu Date: Mon, 4 Jan 2021 04:21:34 +0000 Subject: [PATCH] outfit-images: add api endpoint Just returns the placeholder image right now! --- api/outfitImage.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 api/outfitImage.js diff --git a/api/outfitImage.js b/api/outfitImage.js new file mode 100644 index 0000000..a21d80b --- /dev/null +++ b/api/outfitImage.js @@ -0,0 +1,19 @@ +const beeline = require("honeycomb-beeline")({ + writeKey: process.env["HONEYCOMB_WRITE_KEY"], + dataset: + process.env["NODE_ENV"] === "production" + ? "Dress to Impress (2020)" + : "Dress to Impress (2020, dev)", + serviceName: "impress-2020-gql-server", +}); + +const { renderOutfitImage } = require("../src/server/outfit-images"); + +async function handle(req, res) { + const image = await renderOutfitImage(); + return res.status(200).setHeader("Content-Type", "image/png").send(image); +} + +export default async (req, res) => { + beeline.withTrace({ name: "outfitImage" }, () => handle(req, res)); +};