Documentation
¶
Index ¶
- Constants
- func BindRequest[T validatable](c echo.Context) (T, error)
- func SetResponse[T any](c echo.Context, code int, data T) error
- func SetResponseError(c echo.Context, code int, err HTTPError) error
- func SetResponseList[T any](c echo.Context, code int, data []T, nextCursor string) error
- type HTTPError
- type Handler
- type HealthResponse
- type Option
- func WithCORS(origins ...string) Option
- func WithLogger(logger log.Logger) Option
- func WithMiddleware(middlewares ...echo.MiddlewareFunc) Option
- func WithRequestLogKeys(keys ...string) Option
- func WithRequestTimeout(timeout time.Duration) Option
- func WithTLS(certFile string, keyFile string, caCertFile string) Option
- type RequestLoggerConfigFunc
- type Response
- type ResponseError
- type ResponseList
- type Server
- func (s *Server) Add(method string, path string, handler echo.HandlerFunc)
- func (s *Server) Address() string
- func (s *Server) Any(path string, handler echo.HandlerFunc)
- func (s *Server) Register(pathPrefix string, h Handler, middleware ...echo.MiddlewareFunc)
- func (s *Server) Start() error
- func (s *Server) Stop(ctx context.Context) error
- func (s *Server) WaitHealthy(maxRetries int, interval time.Duration) error
- func (s *Server) WebsSocketAddress() string
Constants ¶
View Source
const DefaultRequestTimeout = 100 * time.Second
Variables ¶
This section is empty.
Functions ¶
func BindRequest ¶
Types ¶
type HTTPError ¶
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
}
type Option ¶
type Option func(opts *options) error
Option optionally configures a Server.
func WithCORS ¶
WithCORS configures the server to authorize Cross-Origin Resource Sharing (CORS) for the provided origins.
func WithMiddleware ¶
func WithMiddleware(middlewares ...echo.MiddlewareFunc) Option
WithMiddleware adds custom middleware to the server.
func WithRequestLogKeys ¶
WithRequestLogKeys adds extra log keys outside the defaults to be included in request logs.
func WithRequestTimeout ¶
WithRequestTimeout sets the timeout for request handlers.
type RequestLoggerConfigFunc ¶
type RequestLoggerConfigFunc func(logger log.Logger) middleware.RequestLoggerConfig
RequestLoggerConfigFunc configures request logging middleware on a Server.
type ResponseError ¶
type ResponseError struct {
Error HTTPError `json:"error"`
}
type ResponseList ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves an API for managing NATS operators, accounts, and users.
func (*Server) Register ¶
func (s *Server) Register(pathPrefix string, h Handler, middleware ...echo.MiddlewareFunc)
func (*Server) WaitHealthy ¶
func (*Server) WebsSocketAddress ¶
WebsSocketAddress returns the server WebSocket address which clients can connect to.
Click to show internal directories.
Click to hide internal directories.