Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
router.post("/", async function bakePost(req, res, next) {
try {
if (!req.body.input) {
throw new TypeError("'input' property is required in request body");
}
if (!req.body.recipe) {
throw new TypeError("'recipe' property is required in request body");
}
const dish = await bake(req.body.input, req.body.recipe);
res.send(dish.value);
} catch (e) {
next(e);
}
});