lmdrouter
lmdrouter copied to clipboard
API Gateway v2 support
Do you have any thoughts on what you'd expect support for the v2 API gateway events to look like in this library? It's a useful abstraction to have, and v1 works fine for now, but it would be good to support the newer API.
I'd prefer to get your thoughts before just going ahead and putting together a PR.
Hi there, sorry for the delay in response.
I just took a quick glance at the V2 event. Sometimes with AWS Lambda events I create an encapsulating struct type that includes all events I want to catch, e.g. something like:
type Event struct {
*events.APIGatewayProxyRequest
*events.CloudWatchEvent
}
And then I check which event I got in the code, but this isn't pretty and won't always work if the two event types share attributes.
In this case it might be necessary to have a NewV2Router()
function that only works with V2 events, but maybe you have a better idea.
Thanks!
I tried to add some fancy interface to also work with HTTP API, but struggled. I've created a fork that works with v2 only at: https://github.com/shodgson/lmdrouterv2