I am getting started with a serverless application and you define functions as this:
exports.handler = async function(event, context) { from what I've seen and I have not been able to find any examples where the parameters are different.
I was wondering if there was any point in the flow where I could use event to parse as MyRequestObject and then define my method as:
exports.handler = async function(MyRequestObject) {
I'm trying to use openAPI and go with a contract based API that is clearly defined and create SDKs from the code so I'm looking to make it pretty specific if possible.
I know that I can do inside the function the following:
const MyObject: MyObject = JSON.parse(event.body) as MyObject;
but I'm looking to have one method that maybe uses reflection to then pass the correct object depending on what the function is expecting.
Thank you