router

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const HttpContentTypeJson string = "application/json"
View Source
const HttpContentTypeLabel string = "content-type"
View Source
const HttpReqBodyLabel string = "req_body"
View Source
const HttpReqParamsPrefix string = "req"
View Source
const HttpReqParamsSeparator = "_"
View Source
const ReqParamHeaderLabel string = "header"
View Source
const ReqParamQueryLabel string = "query"
View Source
const ReqParamUrlLabel string = "url"

Variables

This section is empty.

Functions

func Lookup

func Lookup(files *[]string, routeFileName string) filepath.WalkFunc

Types

type Action

type Action struct {
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

type HttpRouter

type HttpRouter struct {
	Routes []Route
}

func (*HttpRouter) BindChiRouter

func (r *HttpRouter) BindChiRouter() http.Handler

func (*HttpRouter) LoadRoute

func (r *HttpRouter) LoadRoute(path string, routeFileName string)

type Parameter

type Parameter struct {
	Name      string      `json:"name"`
	Type      string      `json:"type"`
	Mandatory bool        `json:"mandatory"`
	Default   interface{} `json:"default,omitempty"`
	ParamType string
}

type Parameters

type Parameters struct {
	Url     []Parameter `json:"url,omitempty"`
	Headers []Parameter `json:"headers,omitempty"`
	Query   []Parameter `json:"query,omitempty"`
}

type Route

type Route struct {
	Method     string     `json:"method"`
	Path       string     `json:"path"`
	Parameters Parameters `json:"parameters"`
	Action     Action     `json:"action"`
	Exceptions []string   `json:"exceptions,omitempty"`
}

type Routes

type Routes struct {
	Routes []Route `json:"routes"`
}

Jump to

Keyboard shortcuts

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