| 118 | * Fastify server instance. Returned by the core `fastify()` method. |
| 119 | */ |
| 120 | export interface FastifyInstance< |
| 121 | RawServer extends RawServerBase = RawServerDefault, |
| 122 | RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>, |
| 123 | RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>, |
| 124 | Logger extends FastifyBaseLogger = FastifyBaseLogger, |
| 125 | TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault |
| 126 | > { |
| 127 | server: RawServer; |
| 128 | pluginName: string; |
| 129 | prefix: string; |
| 130 | version: string; |
| 131 | log: Logger; |
| 132 | listeningOrigin: string; |
| 133 | addresses(): AddressInfo[] |
| 134 | withTypeProvider<Provider extends FastifyTypeProvider>(): FastifyInstance<RawServer, RawRequest, RawReply, Logger, Provider>; |
| 135 | |
| 136 | addSchema(schema: unknown): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>; |
| 137 | getSchema(schemaId: string): unknown; |
| 138 | getSchemas(): Record<string, unknown>; |
| 139 | |
| 140 | after(): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider> & SafePromiseLike<undefined>; |
| 141 | after(afterListener: (err: Error | null) => void): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>; |
| 142 | |
| 143 | close(): Promise<undefined>; |
| 144 | close(closeListener: () => void): undefined; |
| 145 | |
| 146 | /** Alias for {@linkcode FastifyInstance.close()} */ |
| 147 | |
| 148 | // @ts-ignore - type only available for @types/node >=17 or typescript >= 5.2 |
| 149 | [Symbol.asyncDispose](): Promise<undefined>; |
| 150 | |
| 151 | // should be able to define something useful with the decorator getter/setter pattern using Generics to enforce the users function returns what they expect it to |
| 152 | decorate: DecorationMethod<FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>>; |
| 153 | decorateRequest: DecorationMethod<FastifyRequest, FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>>; |
| 154 | decorateReply: DecorationMethod<FastifyReply, FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>>; |
| 155 | |
| 156 | getDecorator<T>(name: string | symbol): T; |
| 157 | |
| 158 | hasDecorator(decorator: string | symbol): boolean; |
| 159 | hasRequestDecorator(decorator: string | symbol): boolean; |
| 160 | hasReplyDecorator(decorator: string | symbol): boolean; |
| 161 | hasPlugin(name: string): boolean; |
| 162 | |
| 163 | addConstraintStrategy(strategy: ConstraintStrategy<FindMyWayVersion<RawServer>, unknown>): void; |
| 164 | hasConstraintStrategy(strategyName: string): boolean; |
| 165 | |
| 166 | inject(opts: InjectOptions | string, cb: LightMyRequestCallback): void; |
| 167 | inject(opts: InjectOptions | string): Promise<LightMyRequestResponse>; |
| 168 | inject(): LightMyRequestChain; |
| 169 | |
| 170 | listen(opts: FastifyListenOptions, callback: (err: Error | null, address: string) => void): void; |
| 171 | listen(opts?: FastifyListenOptions): Promise<string>; |
| 172 | listen(callback: (err: Error | null, address: string) => void): void; |
| 173 | |
| 174 | ready(): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider> & SafePromiseLike<undefined>; |
| 175 | ready(readyListener: (err: Error | null) => void | Promise<void>): FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>; |
| 176 | |
| 177 | register: FastifyRegister<FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider> & SafePromiseLike<undefined>>; |
no outgoing calls
no test coverage detected