Documentation
¶
Overview ¶
Package httpapi is the host's HTTP surface, path for path and shape for shape with the TypeScript host it replaces (overlay-blueprints src/http.ts):
POST /submit BRC-22: body = BEEF bytes, header x-topics; answers the BARE STEAK map
POST /lookup BRC-24: {service, query}; answers {type, outputs:[{beef:[bytes], outputIndex}]}
GET /healthz liveness
GET /readyz storage and the chain tracker both answer
GET /metrics Prometheus
POST /admin/checkpoint store backup, loopback callers only (see docs/storage.md)
Both are mounted at the ROOT, as the released Express server does. GASP peer routes and the TypeScript host's other /admin routes are not served.
Index ¶
Constants ¶
const ( MaxBody = 64 << 20 MaxQuestion = 64 << 10 )
MaxBody matches the bridge's object ceiling; MaxQuestion is generous for a BRC-24 question and three orders of magnitude below it.
Variables ¶
This section is empty.
Functions ¶
func ParseTopics ¶
ParseTopics reads x-topics in both wire forms: a JSON array (the SDK's facilitator) or a comma list (the generated server's binder). Values are trimmed; a repeated header, an empty entry or no topic at all is an error rather than a silently shorter list. (Upstream's Go server comma-splits UNTRIMMED and reads only the first value; this host does not inherit that.)
Types ¶
type Deps ¶
type Deps struct {
Submit Submitter
Lookup Looker
Topics []string
Ready func() bool
Metrics *metrics.Metrics
Log *slog.Logger
// Checkpoint writes a store backup named name and returns its directory.
// Nil leaves POST /admin/checkpoint unserved. The route answers loopback
// callers only: the backup timer on the host, never a remote client.
Checkpoint func(ctx context.Context, name string) (string, error)
}
Deps is what the server needs.
type Looker ¶
type Looker interface {
Lookup(ctx context.Context, q *lookup.LookupQuestion) (*lookup.LookupAnswer, error)
}
Looker is the engine's lookup.