-
-
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
Refactoring to support async/await #87
Comments
i use:
|
That's a good one @jamilservicos! It's the Note that I would prefer the following: const html = await app.view("template/index", {teste: "hello"})
reply.code(200).header('Content-Type', 'text/html; charset=utf-8')
return html |
I use this my shortcut in a plugin just passing:
plugin:
|
I'm just rewite previous decorator in async style: fastify.decorate('render', async (view, options, reply) => {
return reply.code(200)
.header('Content-Type', 'text/html; charset=utf-8')
.send(await fastify.view(view, options));
}); |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I think it's due that we improve the support for async/await in this module.
Currently, it's not working as expected mainly because loading templates could be asynchronous, and that does not work well with the internal call to
.send()
, as there is no way to await that.It following should work with any template engine.
What we need as next steps is a proposal to implement an API that could be awaited upon, and then an implementation.
The text was updated successfully, but these errors were encountered: