-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Allow templates to be rendered without reply #59
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.
Awesome!
Can you also add a test to verify the output of fastify.view
and update the documentation?
@delvedor sure! Do you want all the same testcases as for |
Just one should be fine :) |
@delvedor so it turned out to be more difficult than initially thought. I made the renderer functions returning promises, so they can be used when calling in a non-response aware context (the functions had some |
CI is failing for Node 6. I’m somewhat -1 on returning a promise in the renderer. The action was synchronous before and it become asynchronous now. |
@mcollina I brought back the original synchronous functionality (so no breaking changes 💪). The new |
There is no reason to have |
@mcollina but what about the _readCallback then? |
You are right. I would go for a callback if there is one, or a Promise if there is none. |
@mcollina I've updated the PR accordingly 👍 |
Something you'll need to render a template without a "reply" context. Like a notification email for example. This PR adds
fastify.view()
just for that.