grpc-host-builder
用于gRPC主机的轻量级配置器
安装
npm i grpc-host-builder
用法
const { GrpcHostBuilder } = require ( "grpc-host-builder" ) ;
/*...*/
class InterceptorForTom {
constructor ( serverContext ) {
this . _logger = serverContext . createLogger ( ) ;
}
async invoke ( call , methodDefinition , next ) {
/*...*/
if ( call . request . name === "Tom" ) return { message : "Hello again, Tom!
1