You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking into using the new Event Handler utility, but specifically with decorators. This PR adds documentation and examples for HTTP Router decorators in the Event Handler utility. The decorator syntax was fully implemented but completely undocumented - this fills that documentation gap.
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link
Have added a few comments. Something I noticed is that a lot the highlighting in the code examples was off by one or two lines. If you do npm run docs:local:setup followed by docs:local:run you will be able to view your docs on http://127.0.0.1:8000/powertools/typescript/latest/features/event-handler/http to verifiy that they look correct.
@aws-powertools/lambda-typescript No related issues found. Please ensure 'pending-release' label is applied before releasing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
documentationImprovements or additions to documentationsize/LPRs between 100-499 LOC
3 participants
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.
Summary
I was looking into using the new Event Handler utility, but specifically with decorators. This PR adds documentation and examples for HTTP Router decorators in the Event Handler utility. The decorator syntax was fully implemented but completely undocumented - this fills that documentation gap.
Changes
Documentation (
docs/features/event-handler/http.md):@app.errorHandler())@app.notFound(),@app.methodNotAllowed())Example Files (4 new files in
examples/snippets/event-handler/http/):gettingStarted_decorators_basic.ts- Basic route handler decoratorsgettingStarted_error_handling_decorators.ts- Error handler decoratorsgettingStarted_built_in_error_handler_decorators.ts- Built-in error handler decoratorsadvanced_mw_middleware_order_decorators.ts- Middleware with decoratorsCoverage:
@app.get(),@app.post(),@app.put(), etc)@app.errorHandler(ErrorClass)@app.notFound(),@app.methodNotAllowed()){ scope: this }Issue number: closes #4951
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.