server

package
v0.0.0-...-8b8e41a Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GroupWrapper

func GroupWrapper[A any](g *echo.Group, path string, httpMethod HttpMethod, f func(a A, ctx echo.Context) error)

GroupWrapper a utility function to be able to bind sent parameters to the handler in a group as golang struct type and validate them.

func Wrapper

func Wrapper[A any](s *Server, path string, httpMethod HttpMethod, f func(a A, ctx echo.Context) error)

Wrapper a utility function to be able to bind sent parameters to the handler as golang struct type and validate them.

Types

type Controller

type Controller interface {
	// Setup controllers should set up their routes, middlewares and ... in this method
	Setup(*Server)
}

Controller each package wanting to define request handlers should implement this interface

type HttpMethod

type HttpMethod string

HttpMethod methods which echo server accepts

const (
	MethodGet     HttpMethod = "GET"
	MethodHead    HttpMethod = "HEAD"
	MethodPost    HttpMethod = "POST"
	MethodPut     HttpMethod = "PUT"
	MethodPatch   HttpMethod = "PATCH" // RFC 5789
	MethodDelete  HttpMethod = "DELETE"
	MethodConnect HttpMethod = "CONNECT"
	MethodOptions HttpMethod = "OPTIONS"
	MethodTrace   HttpMethod = "TRACE"
)

Methods copied from echo itself

type Server

type Server struct {
	Echo *echo.Echo
}

Server responsible for serving discount requests

func New

func New(serverConfig config.ServerConfig) *Server

New build a new server

Jump to

Keyboard shortcuts

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