Repository with my personal site
voytechnology / protoc-gen-rest Goto Github PK
View Code? Open in Web Editor NEWCreate easy to consume REST APIs from protobufs
License: Apache License 2.0
Create easy to consume REST APIs from protobufs
License: Apache License 2.0
Accept Content-Type: application/json
and return the result. This should be the default as its a widely used standard.
Because we do not support input data, we would want to match parts of the request path and match it to the request.
eg.
rpc Multiply(Request) returns (Response) {
option (google.api.http) = {
get: "/multiply/{a}/{b}"
};
}
message Request {
int a = 1;
int b = 2;
}
GET /multiply/2/3
6
func (s *Server) Multiply(ctx context.Context, req *pb.Request) (*pb.Response, error) {
fmt.Println(req) // { A: 2, B: 3 }
return &pb.Response{Result: req.A * req.B}, nil
}
Generate the client side code so that you can use http.Client
to make requests.
We should be able to decode the raw proto data returned.
While we cannot implement compatibility with every other protoc generator, connect-go looks like it might be a good fit
This would be possibly done with a opt
library_compat=connect-go
With default being ""
The service interface should only be created conditionally - if the server already has gRPC generated, we should not generate it again.
Perhaps this can be done with a generator option:
service_interface: false
Make the generated code compatible with gRPC by using library_compat=grpc
option.
Generate server side code. This should return a http.Handler
which will listen to the incoming HTTP requests and use the provided server interface to call the service methods.
If we get a GET
request, we should not be attempting to parse the input variable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.