Skip to content

Commit

Permalink
Expose both common uses in the top level, forwarding to specific pkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
LLKennedy committed Jan 27, 2020
1 parent 435e253 commit f23d4aa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions converter/converter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package converter

import (
"net/http"

"google.golang.org/grpc"
)

// ProxyRequest proxies an HTTP request through a GRPC connection compliant with httpgrpc/proto
func ProxyRequest(w http.ResponseWriter, r *http.Request, conn *grpc.ClientConn) {
return
}
19 changes: 19 additions & 0 deletions httpgrpc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package httpgrpc

import (
"net/http"

"github.com/LLKennedy/httpgrpc/converter"
"github.com/LLKennedy/httpgrpc/proxy"
"google.golang.org/grpc"
)

// ProxyRequest proxies an HTTP request through a GRPC connection compliant with httpgrpc/proto
func ProxyRequest(w http.ResponseWriter, r *http.Request, conn *grpc.ClientConn) {
converter.ProxyRequest(w, r, conn)
}

// NewServer creates a new server to convert httpgrpc/proto messages to service-specific messages
func NewServer(api interface{}, server interface{}, listener *grpc.Server) (*proxy.Server, error) {
return proxy.NewServer(api, server, listener)
}

0 comments on commit f23d4aa

Please sign in to comment.