v1

package
v0.0.0-...-506b656 Latest Latest
Warning

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

Go to latest
Published: May 16, 2017 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VERSION      = "v1"
	TASKS_PREFIX = "/" + VERSION + "/tasks"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointsInfo

type EndpointsInfo struct {
	Endpoints []HandlerInfo
}
var Routes *EndpointsInfo = &EndpointsInfo{
	Endpoints: []HandlerInfo{
		{
			Regexp:          regexp.MustCompile("^" + TASKS_PREFIX + "$"),
			NeedJSONHandler: true,
			Handlers: MethodHandlers{
				"GET":  handlers.ListTasksHandler,
				"POST": handlers.CreateTaskHandler,
			},
		},
		{
			Regexp:          regexp.MustCompile("^/ping$"),
			NeedJSONHandler: false,
			Handlers: MethodHandlers{
				"GET": handlers.PingHandler,
			},
		},
		{
			Regexp:          regexp.MustCompile("^/"),
			NeedJSONHandler: false,
			Handlers: MethodHandlers{
				"GET": handlers.EmptyHandler,
			},
		},
	},
}

type HandlerInfo

type HandlerInfo struct {
	Regexp          *regexp.Regexp
	Handlers        MethodHandlers
	NeedJSONHandler bool
}

type MethodHandlers

type MethodHandlers map[string]api.Handler

Jump to

Keyboard shortcuts

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