Here's a beaut that I learned along the way - A really nice library called 'Yup' that can be used for Express parameter validation.
exports.sendReceiptEmail = functions.https.onRequest((request, response) => {
const schema = yup.object().shape({
to: yup.string().email().required(),
customer_name: yup.string().required(),
merchant_name: yup.string().required(),
card_brand: yup.string().required(),
card_last_four: yup.string().required(),
description: yup.string().required(),
total: yup.string().required()
})
schema.validate(request.body).catch(err => {
functions.logger.error(err)
return response.send(err, 400)
})
// More code after here
}

Log in or sign up for Devpost to join the conversation.