outfit-images: add api endpoint

Just returns the placeholder image right now!
This commit is contained in:
Emi Matchu 2021-01-04 04:21:34 +00:00
parent d875b5f6ce
commit d10fe5f68f

19
api/outfitImage.js Normal file
View file

@ -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));
};