build(deps-dev): apply updates
[poolifier.git] / examples / typescript / http-server-pool / fastify-hybrid / src / fastify-worker.ts
index 9c2cb3c52d57e95f5452e624a0bde9ffd4e1a4ed..0f4f6370b4c5249a2dfc8f2b4169d0245bbdda68 100644 (file)
@@ -13,15 +13,18 @@ ClusterWorkerResponse
   private static readonly startFastify = async (
     workerData?: ClusterWorkerData
   ): Promise<ClusterWorkerResponse> => {
-    const { port } = workerData as ClusterWorkerData
+    const { port, ...fastifyPoolifierOptions } = workerData!
 
     FastifyWorker.fastify = Fastify({
       logger: true
     })
 
-    await FastifyWorker.fastify.register(fastifyPoolifier, workerData)
+    await FastifyWorker.fastify.register(
+      fastifyPoolifier,
+      fastifyPoolifierOptions
+    )
 
-    FastifyWorker.fastify.all('/api/echo', async (request) => {
+    FastifyWorker.fastify.all('/api/echo', async request => {
       return (
         await FastifyWorker.fastify.execute({ data: request.body }, 'echo')
       ).data
@@ -29,7 +32,7 @@ ClusterWorkerResponse
 
     FastifyWorker.fastify.get<{
       Params: { number: number }
-    }>('/api/factorial/:number', async (request) => {
+    }>('/api/factorial/:number', async request => {
       const { number } = request.params
       return (
         await FastifyWorker.fastify.execute({ data: { number } }, 'factorial')