Documentation
¶
Overview ¶
Package api provides HTTP handlers for the Nexus gateway. These handlers use standard net/http and can be mounted on any HTTP router (chi, gorilla/mux, stdlib ServeMux, forge.Router).
When used with forge, the extension package wraps these with forge.Context and OpenAPI metadata.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API wires all HTTP handlers for the Nexus gateway.
func New ¶
New creates a new API handler set. It panics when gw has no key service, which means Initialize has not run: the routes cannot be protected, and serving them open would be worse than not serving them.
type Option ¶
type Option func(*API)
Option configures the API handler set.
func WithStreamEncoder ¶
func WithStreamEncoder(contentType string, enc httpstream.StreamEncoder) Option
WithStreamEncoder registers a stream encoder for content-type negotiation on streaming completion responses.
func WithWebSocket ¶
func WithWebSocket(opts httpstream.WSOptions) Option
WithWebSocket configures the bidirectional WebSocket endpoint at /v1/realtime. Pass an empty WSOptions{} for defaults.
func WithoutWebSocket ¶
func WithoutWebSocket() Option
WithoutWebSocket disables the /v1/realtime WebSocket endpoint.