framework

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindDeleteData

func BindDeleteData(ctx Context) (*model.DeleteData, error)

BindDeleteData returns a delete data struct extracted from the body and an error to be checked in the handler.

func BindPost

func BindPost(ctx Context) (*model.Post, error)

BindPost returns a post struct extracted from the body and an error to be checked in the handler.

func BindUpdateData

func BindUpdateData(ctx Context) (*model.UpdateData, error)

BindUpdateData returns a update data struct extracted from the body and an error to be checked in the handler.

func GetID

func GetID(ctx Context) (uint64, error)

GetID gets the ID param from the URL and is returned with an error to be checked in the handler.

func SendCreated

func SendCreated(ctx Context, data *model.DeleteData) error

SendCreated sends a JSON 201 Created response with a delete code struct as the body.

func SendOK

func SendOK(ctx Context, data interface{}) error

SendOK sends a JSON 200 OK response with any given data as the body.

Types

type App

type App = echo.Echo

App is a type alias for "echo.Echo".

func NewApp

func NewApp() *App

NewApp returns an empty App where routes will be set up.

type Context

type Context = echo.Context

Context is a type alias for "echo.Context"

type HTTPError

type HTTPError = echo.HTTPError

HTTPError is a type alias for "echo.HTTPError".

func SendError

func SendError(status int) *HTTPError

SendError sends any error and a message as the body.

type HandlerFunc

type HandlerFunc = echo.HandlerFunc

HandlerFunc is a type alias for "echo.HandlerFunc".

type MiddlewareFunc

type MiddlewareFunc = echo.MiddlewareFunc

MiddlewareFunc is a type alias for "echo.MiddlewareFunc".

func CORS

func CORS(methods ...string) MiddlewareFunc

CORS returns a CORS middleware given the allowed methods.

func CheckHeader

func CheckHeader(expectedContentType string) MiddlewareFunc

CheckHeader validates the request header.

func RateLimiter

func RateLimiter(ipRateLimiter *limiter.Limiter) MiddlewareFunc

RateLimiter sets and configures a rate limiter.

func RemoveTrailingSlash

func RemoveTrailingSlash() MiddlewareFunc

RemoveTrailingSlash removes the trailing slash from URLs.

func Secure

func Secure() MiddlewareFunc

Secure sets some headers to avoid some attacks.

Jump to

Keyboard shortcuts

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