@grpc.ts/fastify-server
Version:
Fastify package for server
27 lines (25 loc) • 1.03 kB
TypeScript
import type { FastifyPluginAsync } from 'fastify';
import type { IGrpcServerProps } from '@grpc.ts/core/lib/interface';
export { createServer, GrpcTimestamp, StatusBuilder, createMetadata, ServerCredentials, createSecureContext, dateToGrpcTimestamp, grpcTimestampToDate, type Timestamp, type StatusObject, type ServiceError, type TUnaryCallback, type ServerUnaryCall, } from '@grpc.ts/core';
declare const _default: FastifyPluginAsync<IGrpcServerProps>;
export default _default;
import type { Server } from '@grpc.ts/core/node_modules/@grpc/grpc-js';
import type {
TUnaryHandlerFunc,
IAddUnaryHandlerOptionsProps,
} from '@grpc.ts/core';
declare module 'fastify' {
export interface FastifyInstance {
grpcServer: {
getServer: (serverName?: string) => {
server: Server;
addUnaryHandler: <TRequest = unknown>(
serviceName: string,
rpcName: string,
impl: TUnaryHandlerFunc<TRequest>,
options?: IAddUnaryHandlerOptionsProps,
) => void;
};
};
}
}