Registry / messaging / egg-plugin-grpc-server

egg-plugin-grpc-server

JSON →
library1.0.51jsnpmunverified

An Egg.js plugin that integrates gRPC server functionality. Current stable version is 1.0.51. It allows defining proto files and implementing gRPC services within an Egg application. Key features include configurable port, host, timeout, and error handling. Note: does not support streaming requests/responses yet. Releases are infrequent, with only a few versions. Primarily useful for adding gRPC server capabilities to Egg.js projects.

messaging
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.

Plugin is declared in plugin.js configuration, not imported directly in code.

// {app_root}/config/plugin.js exports.grpcServer = { enable: true, package: 'egg-plugin-grpc-server' }

GrpcServer is accessible via app.GrpcServer after plugin is enabled.

const grpcServer = new app.GrpcServer(app); grpcServer.start();

Configuration is part of Egg's config merge mechanism.

// {app_root}/config/config.default.js exports.grpcServer = { port: 50051 }

Shows plugin configuration and basic startup in an Egg.js application, including plugin enablement, config, and gRPC server lifecycle.

// {app_root}/config/plugin.js exports.grpcServer = { enable: true, package: 'egg-plugin-grpc-server', }; // {app_root}/config/config.default.js exports.grpcServer = { port: 50051, host: '127.0.0.1', timeOut: 5000, protoDir: 'app/proto', grpcDir: 'app/grpc', errorHandle(error) { // this is ctx console.error(error); }, }; // {app_root}/app.js (startup code) module.exports = app => { app.beforeStart(async () => { const grpcServer = new app.GrpcServer(app); await grpcServer.start(); app.grpcServer = grpcServer; }); app.beforeClose(async () => { await app.grpcServer.close(); }); };
Debug
Known footguns
gotchaStreaming requests/responses not supported.
gotchaIn Egg.js cluster mode, directly starting the server in app.js can cause issues. Use cluster-client for multi-process management.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
16 hits · last 30 days
gptbot
3
bytedance
3
ahrefsbot
1
Resources