![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
grpc-ts-middleware
Advanced tools
A library that assists with the implementation of gRPC pre-, and post-call middleware.
npm install grpc-ts-middleware --save
import * as grpc from 'grpc';
import GrpcMiddleware, { GrpcCall } from 'grpc-ts-middleware';
import { EchoReply, EchoRequest } from './proto/echo_pb';
import { EchoManagerService } from './proto/echo_grpc_pb';
function doEcho(call: grpc.ServerUnaryCall<EchoRequest>, callback: grpc.sendUnaryData<EchoReply>) {
const reply = new EchoReply();
reply.setMessage(call.request.getMessage());
callback(null, reply);
}
function start(): grpc.Server {
// Create the server
const server: grpc.Server = new grpc.Server();
// Create the middleware object
const grpcMiddleware = new GrpcMiddleware(
// An instance of the gRPC server
server,
// An array of functions to be invoked prior to the execution of the gRPC call
[
(call: GrpcCall) => console.log('Pre-call handler 1', call),
(call: GrpcCall) => console.log('Pre-call handler 2', call)
],
// An array of functions to be invoked after the gRPC call has been executed, but before returning the result
[
(error: grpc.ServiceError | null, call: GrpcCall) =>
console.log('Post-call handler 1', call, error),
(error: grpc.ServiceError | null, call: GrpcCall) =>
console.log('Post-call handler 2', call, error)
]
);
// Add gRPC services that you want the middleware to monitor
grpcMiddleware.addService(EchoManagerService, { echo: doEcho });
// Enable propagation of Jaeger tracing headers
grpcMiddleware.enableTracing();
// Bind and start the server
server.bind('localhost:9090', grpc.ServerCredentials.createInsecure());
server.start();
return server;
}
start();
FAQs
gRPC pre-call and post-call middleware
The npm package grpc-ts-middleware receives a total of 3 weekly downloads. As such, grpc-ts-middleware popularity was classified as not popular.
We found that grpc-ts-middleware demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.