AWS lambda 打字稿处理程序架构验证

时间:2021-04-06 14:56:47

标签: node.js typescript amazon-web-services aws-lambda

我是 Typescript 的新手,我正在寻找有关如何从处理程序函数访问 event.body 类型而不是定义接口的建议。我正在使用无服务器 aws-nodejs-typescript 模板。

请求架构:

enter image description here

处理函数:

enter image description here

正如你所看到的 createBeneficiary 函数接受任何类型,现在我更喜欢它是强类型的,我可以创建和接口,但我想知道是否有更好的方法,因为它已经在请求模式中定义。谢谢!

0 个答案:

没有答案