see module preferred license /** */ import { Router } from 'express' ; import { registerGrpcWebRoutes } from '../grpc_web/server/server' ; import { ModuleRpcContextServer } from '../../context/server' ; import { ModuleRpcCommon } from '../../common' ; import { ModuleRpcServer } from '../../server' ; export interface RpcServerOptions { /** The express router to start from.  By default, we start from `Router()`. */ router ? : Router ; /** A function to capture errors that occurred during RPCs. */ captureError ? : ( err : Error , errorContext : { url ? : string ; } ) => void ; } export function registerRpcRoutes < serviceDefinition extends ModuleRpcCommon . ServiceDefinition > ( serviceDefinition , serviceHandler , options ? ) ; export function registerRpcRoutes < serviceDefinition extends ModuleRpcCommon . ServiceDefinition , RequestContext > ( serviceDefinition , serviceHandler , options ) ; export function registerRpcRoutes < serviceDefinition extends ModuleRpcCommon . ServiceDefinition , RequestContext > ( serviceDefinition , serviceHandler , options = { } ) { const serverContextConnector = options . serverContextConnector || new ModuleRpcContextServer . EmptyServerContextConnector ( ) ; return registerGrpcWebRoutes ( serviceDefinition , serviceHandler , serverContextConnector , { router : options . router , reportError : options . captureError , } ) ; }