npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ravanallc/grpc-server-reflection

v0.1.6

Published

gRPC server reflection for Node.js - Changed for a simple fix plus testing on reading from proto files instead of compiled

Downloads

1,202

Readme

grpc-server-reflection

gRPC server reflection for Node.js.

Using the reflection on your server allows your clients to get information regarding available RPCs and their format without actually having the schema definition.

With reflection you can use tools like grpcurl or wombat to call and test the API without linking the schema files, but just by accessing the live server.

Usage

The package adds a defined reflection service implementation to your server. The data about your schema is read from a descriptor set, which you can produce with your code generator.

Generate descriptor set

Generate descriptor set with grpc_tools_node_protoc using descriptor_set_out and include_imports, e.g.:

grpc_tools_node_protoc
    --descriptor_set_out=path/to/descriptor_set.bin
    --include_imports
    ./api/**/*.proto

Add reflection

import { Server } from '@grpc/grpc-js';
import { addReflection } from 'grpc-server-reflection'

const server = new Server()
addReflection(server, 'path/to/descriptor_set.bin')

Notes

  • Reflection can be added before or after registering other services
  • All services from descriptor set are available
  • Server reflection service is not included (unless added manually in the descriptor set)
  • Running tests requires grpc_cli

Thanks

This project is heavily inspired and ports some parts of code from nice-grpc-server-reflection. I respectfully burrowed some of the code based on encouragement from the author, to available solid server reflection for Node.js for general purpose. I tried to implement it myself but failed due to some incompatibilities with binary format in protobuf-js with the C++ implementation. Using descriptor sets avoids as in the referenced project avoids the issues.

See also

Here is a list and comparison with the similar projects:

| package | full support | @grpc/grpc-js support | grpc support | framework agnostic | service detection | | ------------------------------------------------------------------------------------------ | ------------ | ----------------------- | -------------- | ------------------ | ----------------- | | grpc-server-reflection | ✅️ | ✅️ | ✅️ | ✅️ | ✅️ | | nice-grpc-server-reflection | ✅️ | ✅️ | ❌ | ❌ | ❌ | | grpc-node-server-reflection | ❌ | ✅️ | ❌ | ❌ | ❌ | | grpc-reflection-js | ❌ | ✅️ | ❌ | ❌ | ❌ |

License

MIT