-
Notifications
You must be signed in to change notification settings - Fork 186
docs(event-handler): add http router decorator examples #4950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
docs(event-handler): add http router decorator examples #4950
Conversation
|
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
|
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 |
| const app = new Router({ logger }); | ||
|
|
||
| class Lambda implements LambdaInterface { | ||
| @app.route('/todos/:todoId', ['GET', 'HEAD']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@svozza I don't think we support this - do we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, you're correct! I should have caught that. @matthew2564 can you remove the docs for the route method.
|



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.