-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
bugConfirmed bugConfirmed buggood first issueGood for newcomersGood for newcomerstypescriptTypeScript relatedTypeScript related
Description
Assume that I have two classes A and B and each class has one async function each.
export class A {
public static async handle(request, reply) {
// content
}
}
export class B {
public static async handle(request, reply) {
// content
}
}I want to call both of these functions in the preHandler hook of a request. Currently I am doing something like this:
preHandler: async (request, reply) => {
await A.handle(request, reply);
await B.handle(request, reply);
}💬 Question
Is this the best way to call two async functions in the preHandler or is there a better cleaner way of calling these two functions in the preHandler? I checked the preHandler definition and that it only accepts either an array of synchronous functions that can be called or a single async function as it's value, is that right?
Your Environment
- node version: 18
- fastify version: >=4.11.0
- os: Linux
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugConfirmed bugConfirmed buggood first issueGood for newcomersGood for newcomerstypescriptTypeScript relatedTypeScript related