Home / Function/ getHandler() — fastify Function Reference

getHandler() — fastify Function Reference

Architecture documentation for the getHandler() function in reply.test-d.ts from the fastify codebase.

Entity Profile

Dependency Diagram

graph TD
  21aea9d1_0344_d436_4080_ca7b8e123a43["getHandler()"]
  bb27a9fb_dfa1_ed14_42f8_48c01ddb6a0b["reply.test-d.ts"]
  21aea9d1_0344_d436_4080_ca7b8e123a43 -->|defined in| bb27a9fb_dfa1_ed14_42f8_48c01ddb6a0b
  style 21aea9d1_0344_d436_4080_ca7b8e123a43 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

test/types/reply.test-d.ts lines 13–66

const getHandler: RouteHandlerMethod = function (_request, reply) {
  expectType<RawReplyDefaultExpression>(reply.raw)
  expectType<FastifyBaseLogger>(reply.log)
  expectType<FastifyRequest<RouteGenericInterface, RawServerDefault, RawRequestDefaultExpression>>(reply.request)
  expectType<<Code extends number>(statusCode: Code) => DefaultFastifyReplyWithCode<Code>>(reply.code)
  expectType<<Code extends number>(statusCode: Code) => DefaultFastifyReplyWithCode<Code>>(reply.status)
  expectType<(...args: [payload?: unknown]) => FastifyReply>(reply.code(100 as number).send)
  expectType<number>(reply.elapsedTime)
  expectType<number>(reply.statusCode)
  expectType<boolean>(reply.sent)
  expectType<
          (hints: Record<string, string | string[]>, callback?: (() => void) | undefined) => void
            >(reply.writeEarlyHints)
  expectType<((...args: [payload?: unknown]) => FastifyReply)>(reply.send)
  expectAssignable<(key: string, value: any) => FastifyReply>(reply.header)
  expectAssignable<(values: { [key: string]: any }) => FastifyReply>(reply.headers)
  expectAssignable<(key: string) => number | string | string[] | undefined>(reply.getHeader)
  expectAssignable<() => { [key: string]: number | string | string[] | undefined }>(reply.getHeaders)
  expectAssignable<(key: string) => FastifyReply>(reply.removeHeader)
  expectAssignable<(key: string) => boolean>(reply.hasHeader)
  expectType<(url: string, statusCode?: number) => FastifyReply>(reply.redirect)
  expectType<() => FastifyReply>(reply.hijack)
  expectType<() => void>(reply.callNotFound)
  expectType<(contentType: string) => FastifyReply>(reply.type)
  expectType<(fn: (payload: any) => string) => FastifyReply>(reply.serializer)
  expectType<(payload: any) => string | ArrayBuffer | Buffer>(reply.serialize)
  expectType<(fulfilled: () => void, rejected: (err: Error) => void) => void>(reply.then)
  expectType<
      (
      key: string,
      fn: ((reply: FastifyReply, payload: string | Buffer | null) => Promise<string>) |
        ((reply: FastifyReply, payload: string | Buffer | null,
          done: (err: Error | null, value?: string) => void) => void)
      ) => FastifyReply
        >(reply.trailer)
  expectType<(key: string) => boolean>(reply.hasTrailer)
  expectType<(key: string) => FastifyReply>(reply.removeTrailer)
  expectType<FastifyInstance>(reply.server)
  expectAssignable<
          ((httpStatus: string) => DefaultSerializationFunction | undefined)
            >(reply.getSerializationFunction)
  expectAssignable<
          ((schema: { [key: string]: unknown }) => DefaultSerializationFunction | undefined)
            >(reply.getSerializationFunction)
  expectAssignable<
          ((schema: { [key: string]: unknown }, httpStatus?: string) => DefaultSerializationFunction)
            >(reply.compileSerializationSchema)
  expectAssignable<
          ((input: { [key: string]: unknown }, schema: { [key: string]: unknown }, httpStatus?: string) => unknown)
            >(reply.serializeInput)
  expectAssignable<((input: { [key: string]: unknown }, httpStatus: string) => unknown)>(reply.serializeInput)
  expectType<ContextConfigDefault & FastifyRouteConfig & FastifyContextConfig>(reply.routeOptions.config)
  expectType<string>(reply.getDecorator<string>('foo'))
}

Domain

Subdomains

Frequently Asked Questions

What does getHandler() do?
getHandler() is a function in the fastify codebase, defined in test/types/reply.test-d.ts.
Where is getHandler() defined?
getHandler() is defined in test/types/reply.test-d.ts at line 13.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free