-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose both common uses in the top level, forwarding to specific pkgs
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |