Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Start ¶
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. The read and write timeouts are unset (unlimited) unless WithReadTimeout or WithWriteTimeout is passed.
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
WithAllowedOrigins restricts CORS to the given origins. Without it, or with no origins, every origin is allowed.
func WithBodyLimit ¶ added in v1.16.0
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
WithIdleTimeout overrides the default 120s keep-alive idle timeout.
func WithReadHeaderTimeout ¶ added in v1.16.0
WithReadHeaderTimeout overrides the default 10s read-header timeout.
func WithReadTimeout ¶ added in v1.17.0
WithReadTimeout caps the time to read a whole request, headers and body, so a client trickling body bytes cannot hold a connection open. It is off by default (zero means unlimited). Uploads that take longer than d are cut off, so size it for the slowest upload the service accepts.
func WithWriteTimeout ¶ added in v1.17.0
WithWriteTimeout caps the time from the end of reading the request headers to the end of writing the response. It is off by default (zero means unlimited). Long-running handlers, large downloads and streaming or SSE responses that take longer than d are cut off, so only set it on services that do none of those.
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. |