From: Jérôme Benoit Date: Fri, 11 Aug 2023 22:23:34 +0000 (+0200) Subject: refactor: cleanup promise usage in fastify example X-Git-Tag: v2.6.24~17 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d68ce4c613425da9055e0d1e7cfc82bd4385328f;p=poolifier.git refactor: cleanup promise usage in fastify example Signed-off-by: Jérôme Benoit --- diff --git a/.eslintrc.js b/.eslintrc.js index 44b9c5d2..3a35e685 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -37,6 +37,7 @@ module.exports = defineConfig({ 'warn', { skipWords: [ + 'axios', 'benoit', 'benny', 'browserslist', diff --git a/examples/typescript/http-server-pool/fastify/src/main.ts b/examples/typescript/http-server-pool/fastify/src/main.ts index c17de65b..8a617c6f 100644 --- a/examples/typescript/http-server-pool/fastify/src/main.ts +++ b/examples/typescript/http-server-pool/fastify/src/main.ts @@ -28,17 +28,15 @@ await fastify.register(fastifyPoolifier, { } }) -fastify.all('/api/echo', async (request, reply) => { - await reply.send((await fastify.execute({ body: request.body }, 'echo')).body) +fastify.all('/api/echo', async request => { + return (await fastify.execute({ body: request.body }, 'echo')).body }) fastify.get<{ Params: { number: number } -}>('/api/factorial/:number', async (request, reply) => { +}>('/api/factorial/:number', async request => { const { number } = request.params - await reply.send( - (await fastify.execute({ body: { number } }, 'factorial')).body - ) + return (await fastify.execute({ body: { number } }, 'factorial')).body }) try {