Registry / testing / ges
library1.3.1jsnpmunverified

A gRPC experimental server that adds koa-like interceptors (middleware) to gRPC calls. Current stable version is 1.3.1. The package wraps the official grpc package and provides a middleware pattern similar to Koa.js for handling unary, client streaming, server streaming, and bidirectional streaming calls. It simplifies adding cross-cutting concerns like logging, tracing, and authentication. The package requires peer dependency grpc ^1.22.2 and is specific to Node.js. It is distinct from other gRPC middleware solutions by its Koa-style request/response pipeline.

npm install ges
INSTALL
IMPORT
SIG · GES
G
ges
testingjavascriptv1.3.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import ExperimentalServer from 'ges';
import { ExperimentalServer } from 'ges';
Default export, not named. Use default import syntax.
default (CommonJS)
const ExperimentalServer = require('ges');
const { default: ExperimentalServer } = require('ges');
For CommonJS, the default export is directly on module.exports.
ExperimentalServer type
import ExperimentalServer from 'ges';
import type { ExperimentalServer } from 'ges';
No named type export; the type is inferable from default import.

Shows how to create a gRPC server with a koa-like interceptor for logging request duration.

import ExperimentalServer from 'ges'; import * as grpc from 'grpc'; const server = new ExperimentalServer(); // Define a service (example HelloService) const helloProto = grpc.load('hello.proto'); const helloService = helloProto.helloworld.Greeter.service; server.addService(helloService, { sayHello: (call, callback) => { callback(null, { message: 'Hello ' + call.request.name }); } }); // Add interceptor server.use(async (context, next) => { const start = Date.now(); try { await next(); } finally { console.log('Request took', Date.now() - start, 'ms'); } }); server.bind('0.0.0.0:50051', grpc.ServerCredentials.createInsecure()); server.start(); console.log('Server running on port 50051');
Debug
Known issues
gotchaserver.use() interceptors must call await next() to continue the pipeline; otherwise subsequent handlers are skipped.
fix
Ensure each interceptor awaits next() or returns next() if not async.
affects: >=1.0
gotchaThe package has a typo in the README: 'serer.bind' should be 'server.bind'.
fix
Use correct method name: server.bind().
affects: >=1.0
deprecatedgrpc is deprecated in favor of @grpc/grpc-js.
fix
Consider migrating to @grpc/grpc-js and checking compatibility with ges.
affects: >=1.0
Errors
Common errors & fixes
TypeError: server.use is not a function
Using incorrect import (named instead of default) or not instantiating ExperimentalServer.
fix
Use default import: import ExperimentalServer from 'ges'; then new ExperimentalServer().
Error: Cannot find module 'grpc'
Peer dependency grpc is not installed.
fix
Run npm install grpc.
TypeError: Cannot read property 'definition' of undefined
Interceptor called before addService, or service definition not loaded properly.
fix
Ensure server.addService() is called with valid service object before interceptor is invoked.
Upgrade
Version history
1.3.1latest on npm
Audit
Dependencies
grpcrequiredpeer dependency required for gRPC functionality
Agent activity
2 hits · last 30 days
node
2
Resources
packageges
ges — npm install ges · libregistry