http

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package http provides HTTP-related providers for Zero.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultErrorEncoder

func DefaultErrorEncoder() zero.ErrorEncoder

DefaultErrorEncoder for otherwise unhandled errors. It can be overridden.

The response will be JSON in the form:

{
  "error": "error message",
  "code": code
}

func DefaultResponseEncoder

func DefaultResponseEncoder() zero.ResponseEncoder

DefaultResponseEncoder encodes responses using the default Zero format. It can be overridden.

func DefaultServeMux

func DefaultServeMux() *http.ServeMux

DefaultServeMux returns the default http.ServeMux. It can be overridden.

func DefaultServer

func DefaultServer(ctx context.Context, logger *slog.Logger, config Config, mux *http.ServeMux) *http.Server

Types

type Config

type Config struct {
	Bind string `help:"The address to bind the server to." default:"127.0.0.1:8080"`
}

Jump to

Keyboard shortcuts

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