feat: Introduce LocalLambdaGroup to manage multiple lambdas in a single server instance #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors the LocalLambda class to use
express.Router()
and adds a new LocalLambdaGroup class for managing multiple lambdas.The LocalLambda now uses an instance of
express.Router()
for handling requests, and it includes options for setting binary content-type headers, request context, and enable CORS.In addition, a new LocalLambdaGroup class has been added, which allows for multiple lambdas to be run simultaneously on the same server. It uses the LocalLambda class under the hood to handle each lambda's requests.
Both LocalLambda and LocalLambdaGroup have a
run()
method that starts the server and listens for incoming requests. The LocalLambda instance can also be created separately if needed.I have tested this implementation thoroughly and all existing tests are passing. Please let me know if there is anything else I can do to help merge this PR.
PS. Based on my assessment, it would be best to hold off merging this PR until after #19 has been merged, as there may still be some additional work required on this PR. Therefore, I recommend deferring the merge until after the other PR has been completed.