laconia icon indicating copy to clipboard operation
laconia copied to clipboard

Basic implementation of route adapter for adapter-api

Open VanOvermeire opened this issue 3 years ago • 2 comments

See https://github.com/laconiajs/laconia/issues/764

Unit tests run. Also tried it locally in a project and it worked.

This is a simple implementation: no matching on http method and string matching is limited (does allow asterisks at the end but nothing else). But perhaps sufficient for a first version.

Let me know what you think! If it's ok for now, I can also create a PR for the website documentation.

VanOvermeire avatar May 15 '21 10:05 VanOvermeire

I do now realise that this would not work for version 2 of the HTTP Api, because there it is named 'rawPath'. So the class should actually check version and determine path based on that.

VanOvermeire avatar May 16 '21 15:05 VanOvermeire

Hey @VanOvermeire Thank you for your PR. It's been a super busy week for me, I shall look into this soon this or next week. Thanks for your patience.

@laconiajs/maintainers Any thoughts on the API design?

ceilfors avatar May 20 '21 08:05 ceilfors

Hey there - I am involved with AWS Lambda Powertools (for Python), and there are nuances to handling API routes from Lambda given the different invoke mechanisms: API Gateway Rest V1, API GatewayRestV2, ALB, FunctionUrl - all of which behave differently and package up the data differently (including nuances in the actual payloads).

Python AWS Lambda Powertools for Python has a solid implementation around this - AWS Lambda Powertools is also being developed for Typescript and have a discussion around a feature like this: https://github.com/awslabs/aws-lambda-powertools-typescript/issues/413. Unsure of the timeframe of when the project would prioritise that.

Jeremy Daly also has an implementation of a lightweight lampda-api project: https://github.com/jeremydaly/lambda-api which may be of interest.

Hope this adds value to the discussion.

(Also just noted this has been open for a while now, is this idea dead now)?

walmsles avatar Apr 13 '23 01:04 walmsles

Haven't heard anything after opening the pull request, so yeah I think the idea is dead.

Will close this PR

VanOvermeire avatar Apr 13 '23 07:04 VanOvermeire

@VanOvermeire Apologies, but this fell through the crack. Let me know if you'd like to resume it. @walmsles Thanks for the addition!

ceilfors avatar Apr 14 '23 07:04 ceilfors