@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
49 lines • 1.38 kB
TypeScript
import { Gauge, Histogram, Logger } from "@lodestar/utils";
import { FastifyInstance } from "fastify";
import { SocketMetrics } from "./activeSockets.js";
export type RestApiServerOpts = {
port: number;
cors?: string;
address?: string;
bearerToken?: string;
headerLimit?: number;
bodyLimit?: number;
stacktraces?: boolean;
swaggerUI?: boolean;
};
export type RestApiServerModules = {
logger: Logger;
metrics: RestApiServerMetrics | null;
};
export type RestApiServerMetrics = SocketMetrics & {
requests: Gauge<{
operationId: string;
}>;
responseTime: Histogram<{
operationId: string;
}>;
errors: Gauge<{
operationId: string;
}>;
};
/**
* REST API powered by `fastify` server.
*/
export declare class RestApiServer {
protected readonly opts: RestApiServerOpts;
protected readonly server: FastifyInstance;
protected readonly logger: Logger;
private readonly activeSockets;
constructor(opts: RestApiServerOpts, modules: RestApiServerModules);
/**
* Start the REST API server.
*/
listen(): Promise<void>;
/**
* Close the server instance and terminate all existing connections.
*/
close(): Promise<void>;
/** For child classes to override */
protected shouldIgnoreError(_err: Error): boolean;
}
//# sourceMappingURL=base.d.ts.map