Registry / devops / grpc-dg

grpc-dg

JSON →
library0.4.2jsnpmunverified

A Node.js dynamic gRPC-to-REST/JSON proxy middleware that reads .proto files at runtime without code generation. Version 0.4.2 is the latest; release cadence is irregular. Unlike grpc-gateway (which requires generating a Go server), this package works as Express/Connect middleware, dynamically serving REST endpoints from proto definitions. Supports SSL, CLI usage, and Docker deployment.

npm install grpc-dg
INSTALL
IMPORT
SIG · GRPC-DG
G
grpc-dg
devopsjavascriptv0.4.2
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
const grpcGateway = require('grpc-dynamic-gateway')
import grpcGateway from 'grpc-dynamic-gateway'
Package uses CommonJS; ESM import is not supported.
grpcGateway
const grpcGateway = require('grpc-dynamic-gateway')
No named exports; only default export.

Creates an Express server that serves REST endpoints dynamically from a gRPC proto definition.

const grpcGateway = require('grpc-dynamic-gateway'); const express = require('express'); const bodyParser = require('body-parser'); const app = express(); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); const grpcHost = process.env.GRPC_HOST || '0.0.0.0:5051'; app.use('/', grpcGateway(['api.proto'], grpcHost)); const port = process.env.PORT || 8080; app.listen(port, () => { console.log(`Listening on http://0.0.0.0:${port}`); });
Debug
Known issues
gotchaProto files must be accessible at runtime; no pre-compilation step.
fix
Ensure .proto files are included in deployment or mounted via volume.
affects: >=0.0.0
gotchaPackage uses CommonJS; cannot be imported with ES module import syntax.
fix
Use require() instead of import.
affects: >=0.0.0
breakingDrops support for Node < 6 in version 0.4.0.
fix
Upgrade Node.js to version 6 or later.
affects: >=0.4.0
Errors
Common errors & fixes
Error: Cannot find module 'grpc'
Missing gRPC dependency.
fix
npm install grpc
Error: ENOENT: no such file or directory, open '.../api.proto'
Proto file path is incorrect or missing.
fix
Provide absolute path or correct relative path to .proto file.
TypeError: grpcGateway is not a function
Incorrect import method (ESM import).
fix
Use require('grpc-dynamic-gateway') instead of import.
Upgrade
Version history
0.4.2latest on npm
Audit
Dependencies
expressrequiredUsed as middleware; requires an Express app
body-parseroptionalNeeded for JSON/URL-encoded body parsing in Express
Agent activity
8 hits · last 30 days
node
8
Resources
grpc-dg — npm install grpc-dg · libregistry