UNPKG

949 BTypeScriptView Raw
1import { RawServerBase, RawServerDefault, RawReplyDefaultExpression, RawRequestDefaultExpression } from './utils'
2import * as http from 'http'
3import * as https from 'https'
4import * as http2 from 'http2'
5
6export type FastifyServerFactoryHandler<
7 RawServer extends RawServerBase = RawServerDefault,
8 RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
9 RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>
10> =
11RawServer extends http.Server | https.Server ?
12 (request: http.IncomingMessage & RawRequest, response: http.ServerResponse & RawReply) => void :
13 (request: http2.Http2ServerRequest & RawRequest, response: http2.Http2ServerResponse & RawReply) => void
14
15export interface FastifyServerFactory<
16 RawServer extends RawServerBase = RawServerDefault
17> {
18 (handler: FastifyServerFactoryHandler<RawServer>, opts: Record<string, unknown>): RawServer;
19}