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

grpcnode

v1.1.1

Published

CLI tool for working with gRPC in nodejs, dynamically

Downloads

123

Readme

Simple node-based gRPC client/server

When you want a quick gRPC server or client, made with node.

NPM

cli

Install with npm i -g grpcnode.

Now, you can use it like this:

grpcnode <command>

Commands:
  grpcnode server <FILES...>  Start a gRPC server with your proto and javascript files
  grpcnode client             Act as a client of a gRPC server

Options:
  --help         Show help                                           [boolean]
  --ca           SSL CA cert
  --key          SSL server key
  --cert         SSL server certificate
  -h, --host     The host/port to run the gRPC server on             [default: "localhost:50051"]
  -v, --version  Show version number                                 [boolean]
  -I, --include  Root include path (sorry only one root-path works)

Examples:
  grpcnode client --help  Get more help about the client command
  grpcnode server --help  Get more help about the server command

ssl

With SSL, you will need the Cert Authority certificate, client & server signed certificate and keys.

I generated/signed my demo keys like this:

openssl genrsa -passout pass:1111 -des3 -out ca.key 4096
openssl req -passin pass:1111 -new -x509 -days 365 -key ca.key -out ca.crt -subj  "/C=US/ST=Oregon/L=Portland/O=Test/OU=CertAuthority/CN=localhost"
openssl genrsa -passout pass:1111 -des3 -out server.key 4096
openssl req -passin pass:1111 -new -key server.key -out server.csr -subj  "/C=US/ST=Oregon/L=Portland/O=Test/OU=Server/CN=localhost"
openssl x509 -req -passin pass:1111 -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
openssl rsa -passin pass:1111 -in server.key -out server.key
openssl genrsa -passout pass:1111 -des3 -out client.key 4096
openssl req -passin pass:1111 -new -key client.key -out client.csr -subj "/C=US/ST=Oregon/L=Portland/O=Test/OU=Client/CN=localhost"
openssl x509 -passin pass:1111 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt
openssl rsa -passin pass:1111 -in client.key -out client.key

Then use it on server, like this:

grpcnode server --ca=ca.crt --key=server.key --cert=server.crt -I example/ example/helloworld.proto example/helloworld.js

And client, like this:

grpcnode client run --ca=ca.crt --key=client.key --cert=client.crt -I example/proto helloworld.proto -c '/helloworld.v1.Greeter/SayGoodbye({"name":"World"})'

examples

You can see an example project here that shows how to use all the CLI tools, with no code other than your endpoint implementation.

  • Get a list of methods/message-types: grpcnode client ls -I ./example/proto helloworld.proto
  • Start a server: grpc-server -I example/ example/*.js example/*.proto or node server.js -I example/ example/helloworld.js helloworld.proto
  • Run an RPC on server: grpcnode server -I example/proto helloworld.proto example/helloworld.js