Type alias FastifyServerOptions<RawServer, Logger>

FastifyServerOptions<RawServer, Logger>: {
    ajv?: {
        customOptions?: Options;
        plugins?: (Function | [Function, unknown])[];
    };
    allowUnsafeRegex?: boolean;
    bodyLimit?: number;
    caseSensitive?: boolean;
    clientErrorHandler?: ((error, socket) => void);
    connectionTimeout?: number;
    constraints?: {
        [name: string]: ConstraintStrategy<FindMyWayVersion<RawServer>, unknown>;
    };
    disableRequestLogging?: boolean;
    exposeHeadRoutes?: boolean;
    forceCloseConnections?: boolean | "idle";
    frameworkErrors?: (<RequestGeneric, TypeProvider, SchemaCompiler>(error, req, res) => void);
    genReqId?: ((req) => string);
    ignoreDuplicateSlashes?: boolean;
    ignoreTrailingSlash?: boolean;
    jsonShorthand?: boolean;
    keepAliveTimeout?: number;
    logger?: boolean | FastifyLoggerOptions<RawServer> & PinoLoggerOptions | Logger;
    maxParamLength?: number;
    maxRequestsPerSocket?: number;
    onConstructorPoisoning?: ConstructorAction;
    onProtoPoisoning?: ProtoAction;
    pluginTimeout?: number;
    querystringParser?: ((str) => {
        [key: string]: unknown;
    });
    requestIdHeader?: string | false;
    requestIdLogLabel?: string;
    requestTimeout?: number;
    return503OnClosing?: boolean;
    rewriteUrl?: ((this, req) => string);
    schemaController?: {
        bucket?: ((parentSchemas?) => {
            add(schema): FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTypeProviderDefault>;
            getSchema(schemaId): unknown;
            getSchemas(): Record<string, unknown>;
        });
        compilersFactory?: {
            buildSerializer?: SerializerFactory;
            buildValidator?: ValidatorFactory;
        };
    };
    schemaErrorFormatter?: SchemaErrorFormatter;
    serializerOpts?: Options | Record<string, unknown>;
    serverFactory?: FastifyServerFactory<RawServer>;
    trustProxy?: boolean | string | string[] | number | TrustProxyFunction;
    useSemicolonDelimiter?: boolean;
    versioning?: {
        deriveVersion<Context>(req, ctx?): string;
        storage(): {
            del(version): void;
            empty(): void;
            get(version): null | string;
            set(version, store): void;
        };
    };
}

Options for a fastify server instance. Utilizes conditional logic on the generic server parameter to enforce certain https and http2

Type Parameters

Type declaration