echo

package
v0.0.0-...-2bdc998 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(c echo.Context, err interface{}) error

Error returns a json error with the Internal Server Error status

func ErrorWithStatus

func ErrorWithStatus(c echo.Context, status int, err interface{}) error

ErrorWithStatus returns a json error with the given status

func GetIntQueryParam

func GetIntQueryParam(c echo.Context, param string) (int, error)

GetIntQueryParam returns a query param as a int

func SetAPI

func SetAPI(ee **echo.Echo) error

SetAPI inserts all rest api endpoints

func Stop

func Stop() error

Stop the database connection from authenticaTed

func Success

func Success(c echo.Context, data map[string]interface{}) error

Success returns a json with the OK status

func SuccessWithStatus

func SuccessWithStatus(c echo.Context, status int, data map[string]interface{}) error

SuccessWithStatus returns a json with the given status

Types

type API

type API struct{}

API holds all api handlers

func (*API) DeleteID

func (api *API) DeleteID(c echo.Context) error

DeleteID handles delete requests with a id in it to soft delete the user of the given id

func (*API) Get

func (api *API) Get(c echo.Context) error

Get handles get requests to respond with a list of users the user making the request must have power UserPowerAdmin or greater

func (*API) GetID

func (api *API) GetID(c echo.Context) error

GetID handles get requests with a id in it to return the user of the given id

func (*API) Middleware

func (api *API) Middleware(power auth.UserPower) func(echo.HandlerFunc) echo.HandlerFunc

Middleware is a function that returns a function that returns a function that runs the function given in the first given function so the next function runs at the end of the last function

func (*API) Post

func (api *API) Post(c echo.Context) error

Post handles post requests to create a new user the required fields are: [username, email and password]

func (*API) PostAuth

func (api *API) PostAuth(c echo.Context) error

PostAuth handles post requests to authenticate a user the required fields are: [username || email, password]

func (*API) PutID

func (api *API) PutID(c echo.Context) error

PutID handles put requests with a id in it to update the user of the given id

Jump to

Keyboard shortcuts

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