mods

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIVERSION version.Version = "0.1"
)

Variables

View Source
var (
	Modules = map[string]map[string]HttpApiFunc{
		"GET":     {},
		"POST":    {},
		"DELETE":  {},
		"OPTIONS": {},
	}
)

Functions

func CreateRouter added in v0.2.0

func CreateRouter(eng interface{}) (r *mux.Router, err error)

func HttpError added in v0.2.0

func HttpError(w http.ResponseWriter, err error)

func Marshal added in v0.2.0

func Marshal(r *http.Request, v interface{}) (b []byte, err error)

func NewApiRequest added in v0.2.0

func NewApiRequest(method string, urlStr string, body io.Reader) (req *http.Request, err error)

used for testing

func ParseForm

func ParseForm(r *http.Request) error

If we don't do this, POST method without Content-type (even with empty body) will fail

func Register

func Register(method string, route string, fct HttpApiFunc) (err error)

Types

type HttpApiFunc

type HttpApiFunc func(eng interface{}, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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