web

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 12 Imported by: 0

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

View Source
const GreetTimeout = 2 * time.Second

GreetTimeout bounds the hook call of the /hello/ handler.

View Source
const IdempotencyKey = "Idempotency-Key"

IdempotencyKey is the request header that makes a greeting idempotent: the hook call runs once per key (hook.Key).

Variables

View Source
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.

View Source
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 GraphQL

func GraphQL(g *greeter.Greeter) http.Handler

GraphQL is a tiny GraphQL endpoint: POST {"query": "{ greeting(name: \"x\") }"}.

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.

func ServedBy

func ServedBy(service string) func(http.Handler) http.Handler

ServedBy is HTTP middleware naming the service in a response header.

func Stream

Stream logs every streaming call of the services it wraps at debug.

func Unary

Unary logs every unary call of the services it wraps at debug.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL