powertools-lambda-typescript icon indicating copy to clipboard operation
powertools-lambda-typescript copied to clipboard

feat(event-handler): add base router class

Open dreamorosi opened this issue 7 months ago • 1 comments

Summary

Changes

Please provide a summary of what's being changed

Please add the issue number below, if no issue is present the PR might get blocked and not be reviewed

Issue number: closes #3971


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

dreamorosi avatar May 23 '25 17:05 dreamorosi

I've updated this PR with mkst of the changes that were in scope in #3971:

  • Abstract BaseRouter class with HTTP method decorators ✅
  • Basic route registration interface ✅
  • Support for dynamic routes (:param syntax) ❌ dynamic routing has to be dealt with in the registry, which is implemented in the class that will extend BaseRouter
  • Generic route() method for multiple HTTP methods ❌ route is an abstract method in the Python implementation so I followed that pattern
  • Abstract resolve() method for concrete resolver implementation ✅
  • Basic RouteHandler interface 💹

Note the two requirements not implemented, is there something I'm missing here that would let me ship them in this PR?

svozza avatar Jul 13 '25 23:07 svozza

  • Support for dynamic routes (:param syntax) ❌ dynamic routing has to be dealt with in the registry, which is implemented in the class that will extend BaseRouter

You're right, this should've been in either #4139 or #4140

  • Generic route() method for multiple HTTP methods ❌ route is an abstract class in the Python implementation so I followed that pattern

That's correct, nothing more to do here - it was phrased awkwardly.


Thanks!

dreamorosi avatar Jul 14 '25 08:07 dreamorosi

Thank you both - as discussed offline, we'll merge the PR after tomorrow's release.

dreamorosi avatar Jul 14 '25 22:07 dreamorosi