
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
接受http请求转换成grpc请求并转发到grpc服务, 支持热重载proto文件
http client => [ http server -> grpc client ] => grpc Server
'grpc.max_send_message_length': 128*1024*1024,
'grpc.max_receive_message_length': 128*1024*1024,
npm -g i grpc2http
> 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
add grpc2http.config.json in project root direction
add follow json to file:
{
"grpcHost": "127.0.0.1:9503",
"httpPort": "3503",
"protoPath": "grpc/protos",
}
// 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
FAQs
A grpc api to http api tool
We found that grpc2http demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.