custom-handler

command
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Command custom-handler is the canonical example of the ADR-016 library model: import appximo, register a Class-1 custom handler, compile a single static CGO-free binary. It is the SAME program as the pure `appximo serve` binary plus one registered route — not a different runtime mode.

The handler below is the echo endpoint that used to live inline in cmd_serve.go. It now demonstrates the real library surface: a Handler that receives an appximo.Ctx with the tenant + transaction already resolved, binds the body, enqueues an outbox job IN THE SAME TRANSACTION via ctx.Enqueue, and returns the event id. If the handler returns an error the transaction (and the enqueue) roll back atomically.

Run it like the pure binary (all env vars required):

DATABASE_URL=... JWT_SECRET=... ADMIN_KEY=... \
  go run ./examples/custom-handler --schema examples/quickstart/schema.json

Jump to

Keyboard shortcuts

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