MCPcopy Create free account
hub / github.com/bufbuild/buf-examples / main

Function main

cli/workspace/cmd/api2/api2.go:34–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32var ErrNeedsImplementation = connect.NewError(connect.CodeUnimplemented, errors.New("needs implementation"))
33
34func main() {
35 addr := flag.String("listen", "127.0.0.1:8080", "listen to address on")
36 flag.Parse()
37
38 log.Printf("Observability service starting")
39
40 path, handler := apiv2connect.NewObservabilityServiceHandler(&service{})
41 http.Handle(path, handler)
42 log.Printf("Handling connect service at prefix: %v", path)
43
44 log.Printf("Listening on: %v", *addr)
45 err := http.ListenAndServe(
46 *addr,
47 h2c.NewHandler(http.DefaultServeMux, &http2.Server{}),
48 )
49
50 if err != http.ErrServerClosed {
51 log.Printf("Error running or stopping: %v", err)
52 }
53}
54
55type service struct{}
56

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected