Is there a way to bind `aws.apigateway.x.API` rout...
# general
t
Is there a way to bind
aws.apigateway.x.API
route to a
aws.lambda.Function
? @lemon-spoon-91807
l
Absolutely!
That's simply an EventHandlerRoute
so in your routes to API you would basically do this:
[{ path: "/whatever", method: "GET", eventHandler: yourAwsLambda }]
eventHandler
is typed as
eventHandler: aws.lambda.EventHandler<Request, Response>
And
EventHandler
is just an alias like so:
export type EventHandler<E, R> = Callback<E, R> | LambdaFunction;
where
LambdaFunction
is just
aws.lambda.Function
.
so, basically, we're saying: you can give us a JS callback, or a real aws Lambda.
t
Oh, it was right in front of my nose and I haven't seen it!
thnx
l
absolutely!
we should advertise this functionality more. but it is our intent that any place we allow a JS callback, you should be able to pass a real AWS lambda.