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

grpc2http

v0.1.6

Published

A grpc api to http api tool

Downloads

20

Readme

A grpc api to http api tool

接受http请求转换成grpc请求并转发到grpc服务, 支持热重载proto文件

http client => [ http server -> grpc client ] => grpc Server

Features

  1. 支持热重载proto文件
  2. 支持url query参数和post json参数合并,并映射到grpc参数
  3. 支持http header映射到grpc medadata
  4. proto文件支持import
  5. 支持Web Debugger

Default grpc config

'grpc.max_send_message_length': 128*1024*1024,
'grpc.max_receive_message_length': 128*1024*1024,

Install

npm -g i grpc2http

How To Use

> grpc2http -h
Usage: grpc2http [options]

http client => [ http server -> grpc client ] => grpc Server

Options:
  -v, --version              output the current version
  -i, --input [input]        protos directory
  -g, --grpchost [grpchost]  grpc server host (ip:port)
  -p, --httpport [httpport]  local http listen port
  -o, --oneofs [oneofs]      set proto oneofs config as true
  -e, --enums [enums]        set proto enums config: String | Number
  -c, --config [config]      config file (default name is grpc2http.config.json)
  -h, --help                 display help for command

Use config file

add grpc2http.config.json in project root direction
add follow json to file:
{
    "grpcHost": "127.0.0.1:9503",
    "httpPort": "3503",
    "protoPath": "grpc/protos",
}

sample proto file

// protos/sample.proto

syntax = "proto3";

package mycom.sample;

service User {
  rpc getInfo (GetUserInfoRequest) returns(GetUserInfoResponse) {}
}

message UserInfo {
  int32 userId = 1;
  string name = 2;
  string title = 3;
  int32 age = 4;
}

message GetUserInfoRequest {
  int32 userId = 1;
}

message GetUserInfoResponse {
  int32 code = 1;
  string msg = 2;
  UserInfo data = 3;
}
> http2grpc -i protos/
grpc server host:  127.0.0.1:9503
http listen port:  3503
{
	"mycom.sample": {
		"User": [
			"getInfo"
		]
	}
}
grpc methods list:
/mycom.sample.User/getInfo

Now you can open it from browser:

127.0.0.1:3503/mycom.sample.User/getInfo/?userId=123