Examples

Each page below is a self-contained snippet using the untyped API setup so the runtime primitives are visible. Typed (go-swagger generated) servers call exactly the same primitives — the wiring file is just generated for you. Where a topic has more material than fits on a page (like authentication), it gets its own subsection.

For a fully runnable copy of any of these patterns, the go-swagger/examples sibling repo has end-to-end programs you can clone and run.

Subsections

  • Worked examples covering API keys, HTTP Basic, Bearer/JWT, OAuth2 access-code flow, composed schemes, custom authorizers, and client-side credential attachment.
  • Adding new wire formats, registering vendor MIME types, streaming bodies, per-payload Content-Type overrides, and using the standalone negotiator from a vanilla net/http handler.
  • Composing third-party HTTP middleware around the runtime — recipes that wrap or extend the http.Handler returned by middleware.Serve.