For the most part, Connect handles HTTP routes for you — everything should just work. For debugging or more advanced configuration, this guide explains how Connect builds routes.
Routing follows the Connect and gRPC HTTP/2 protocols, both of which use:
For example, method
GreetService in Protobuf package
/greet.v1.GreetService/Greet. Package, service, and method names are
case-sensitive and used exactly as they are in the Protobuf schema, and
handlers only support the POST verb. (Remember that routing is based on
Protobuf package names, not Go import paths.)
Especially if you're serving your Connect API alongside other HTTP handlers, you
may want to prefix your RPC routes with
/connect/, or something similar.
You can do this using
api := http.NewServeMux()
mux := http.NewServeMux()
mux.Handle("/grpc/", http.StripPrefix("/grpc", api))
Most third-party routers work similarly. If you configure a prefix, be sure to
include it in the base URL you pass to your Connect clients (for example,
grpc-go clients don't support
prefixes: if you need to support gRPC clients, don't prefix your routes!