rest

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(e *echo.Echo, log zerolog.Logger, port string, opts ...Option)

Start configures logging, recovery, CORS and server timeouts on e and serves on port. It always sets a 10s read-header timeout and a 120s idle timeout.

Without WithAllowedOrigins every origin is allowed, and without WithBodyLimit request bodies are unbounded, so production callers should pass both.

Types

type Option added in v1.16.0

type Option func(*config)

Option configures Start.

func WithAllowedOrigins added in v1.16.0

func WithAllowedOrigins(origins ...string) Option

WithAllowedOrigins restricts CORS to the given origins. Without it, or with no origins, every origin is allowed.

func WithBodyLimit added in v1.16.0

func WithBodyLimit(limit string) Option

WithBodyLimit caps request bodies using echo's BodyLimit middleware, e.g. "10M". Larger bodies get 413. An invalid limit panics when the server is configured. Without it bodies are unbounded.

func WithIdleTimeout added in v1.16.0

func WithIdleTimeout(d time.Duration) Option

WithIdleTimeout overrides the default 120s keep-alive idle timeout.

func WithReadHeaderTimeout added in v1.16.0

func WithReadHeaderTimeout(d time.Duration) Option

WithReadHeaderTimeout overrides the default 10s read-header timeout.

Directories

Path Synopsis
Package generator derives an OpenAPI 3.0 document from the source of an Echo application built on compose's rest handlers.
Package generator derives an OpenAPI 3.0 document from the source of an Echo application built on compose's rest handlers.
Package reference renders an OpenAPI 3.x document as a self-hosted API reference page: an alternative to Scalar and Redoc that ships inside the backend, with no CDN assets.
Package reference renders an OpenAPI 3.x document as a self-hosted API reference page: an alternative to Scalar and Redoc that ships inside the backend, with no CDN assets.

Jump to

Keyboard shortcuts

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