A gRPC middleware for Koa that allows building gRPC servers using the familiar Koa middleware pattern. It wraps gRPC services into Koa-style context, enabling middleware chains, routing via koa-mount, and request/response handling with `ctx.request`, `ctx.body`, and `ctx.call`. Current stable version 1.0.6, no recent releases. Differentiators: integrates gRPC with Koa's composable middleware, supports async/await, and uses protobuf generated code via @grpc/proto-loader or grpc-tools.
npm install koa-grpcNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic setup with a gRPC service and a route handler that responds to 'sayHello' method.
Pass an object with service property: new KoaGrpc({ service: MyService })Use (ctx.request as any).getName() or extend types
Install koa-mount and require it, or use @koa/mount
Use ctx.call.request to access request fields
Run grpc_tools_node_protoc as shown in README
Add a route with mount for the method path, e.g., app.use(mount('/sayHello', handler))Ensure the gRPC service definition includes the method and request type is correctly imported
Cast ctx.request to any: (ctx.request as any).getName()