gRPC Service Interceptor
Creates a service from a given gRPC server, allowing you to configure interceptors for its methods.
Installation
$ npm install grpc-service-interceptor --save
Usage
const GrpcServiceInterceptor = require('grpc-service-interceptor');
const service = new GrpcServiceInterceptor({
grpcServer,
grpcServiceDefinition,
});
const firstInterceptor = async (ctx, next) => {
next();
};
const secondInterceptor = async (ctx, next) => {
next();
};
const firstHandler = async (ctx) => {
};
const secondHandler = async (ctx) => {
};
service.addMethod('methodName', firstInterceptor, secondInterceptor, firstHandler);
service.addMethod('anotherMethodName', firstInterceptor, secondInterceptor, secondHandler);
service.configure();