Documentation
¶
Overview ¶
Package web holds hello's HTTP-facing pieces: the /hello/ handler, a tiny GraphQL endpoint, the middleware and the gRPC interceptors its routes are declared with.
Index ¶
- Constants
- Variables
- func GraphQL(g *greeter.Greeter) http.Handler
- func Hello(greet hook.Ref[flows.GreetIn, flows.GreetOut], g *greeter.Greeter) http.Handler
- func ServedBy(service string) func(http.Handler) http.Handler
- func Stream(log *xlog.Logger) grpc.StreamServerInterceptor
- func Unary(log *xlog.Logger) grpc.UnaryServerInterceptor
Constants ¶
const GreetTimeout = 2 * time.Second
GreetTimeout bounds the hook call of the /hello/ handler.
const IdempotencyKey = "Idempotency-Key"
IdempotencyKey is the request header that makes a greeting idempotent: the hook call runs once per key (hook.Key).
Variables ¶
var API embed.FS
API is carried in the binary and delivered on the authenticated platform port. The root document refers to files under schemas/ without a build-time bundler.
var Introspection = []byte(`{"__schema":{"queryType":{"name":"Query"},"types":[` +
`{"kind":"OBJECT","name":"Query","description":"One greeting query with an inline name argument.",` +
`"fields":[{"name":"greeting","description":"Returns a local greeting. ` +
`GraphQL errors use the errors array with HTTP 200.",` +
`"args":[{"name":"name","description":"Name as an inline string literal.",` +
`"type":{"kind":"NON_NULL","ofType":` +
`{"kind":"SCALAR","name":"String"}}}],"type":{"kind":"SCALAR","name":"String"}}]},` +
`{"kind":"SCALAR","name":"String","description":"UTF-8 text."}]}}`)
Introspection is the GraphQL endpoint's introspection result, announced with the api.
Functions ¶
func Hello ¶
Hello serves /hello/?name=: a bound Greet hook answers first; the local greeter is the fallback when there is no Temporal, no binding or no answer in time.
Types ¶
This section is empty.