-
-
Notifications
You must be signed in to change notification settings - Fork 36
do not use try-catch in the example #27
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
Conversation
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.
LGTM this is much better, handles all errors in route
| connectionString: 'postgres://postgres@localhost/postgres' | ||
| }) | ||
|
|
||
| fastify.post('/user/:username', (req, reply) => { |
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.
If we make this async, we can directly return return client.query right?
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.
There is no need to use async at all because Fastify understand promises. However that won't be the normal case for applications.
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, thank you for the info!
e83e2c4 to
e394f7a
Compare
|
@mcollina FYI I can't merge this one |
|
You can now, and you should be able to release as well :) |
|
Thank you! :) this will be a semver minor right? |
|
patch! |
|
Ok so publishing only readme |
As title, I think the example could be simplified a lot.
This has the benefit to potentially avoid unhandled rejections