An Express middleware that reverse-proxies HTTP 1.1 REST requests into HTTP 2.0 gRPC requests and back, making gRPC services accessible to browsers without additional client or server modifications. Version 1.0.1-beta is the latest and only release. It is Node.js only, supports unary and server-side streaming calls, and requires an existing gRPC client connection. Alternative solutions like gRPC-web require TypeScript or Go, while grpc-express integrates seamlessly with Express apps.
npm install grpc-expressNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Set up an Express server that proxies REST requests to a gRPC service using grpc-express middleware.
Design your gRPC service to avoid bidirectional/client-side streaming endpoints.
Replace 'grpc' with '@grpc/grpc-js' and update imports accordingly. Note: grpc-express may not work with @grpc/grpc-js as it relies on grpc.load().
Ensure proto package and service names are unique to avoid endpoint conflicts.
Add custom middleware before using grpcExpress to handle these concerns.
Switch to @grpc/proto-loader and loadPackageDefinition to create gRPC clients.
Run: npm install grpc (or switch to @grpc/grpc-js and adjust code accordingly).
Use: const grpcExpress = require('grpc-express');Check the proto package/service/method names and ensure the URL matches: /packageName/serviceName/methodName.