api

package
v0.0.0-...-ad20016 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	*mux.Router
	Listener net.Listener
}

func New

func New() *Api

func (*Api) Get

func (a *Api) Get(path string, f func(w *Response, r *Request))

func (*Api) MustNoError

func (a *Api) MustNoError(err error, code int, msg interface{})

func (*Api) Post

func (a *Api) Post(path string, f func(w *Response, r *Request))

func (*Api) Put

func (a *Api) Put(path string, f func(w *Response, r *Request))

type ApiError

type ApiError struct {
	Code    int
	Message string
}

func (*ApiError) Error

func (err *ApiError) Error() string

type Request

type Request struct {
	*http.Request
}

func (*Request) JSONRequest

func (r *Request) JSONRequest(out interface{}) error

type Response

type Response struct {
	http.ResponseWriter
}

func (*Response) EmptyResponse

func (w *Response) EmptyResponse(status int)

func (*Response) ErrorResponse

func (w *Response) ErrorResponse(code int, message string)

func (*Response) JSONRespnse

func (w *Response) JSONRespnse(status int, payload interface{})

Jump to

Keyboard shortcuts

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