api

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OutputErr

func OutputErr(w http.ResponseWriter, err error)

Types

type API

type API interface {
	GetAPIs() []*APIHandler
	GetName() string
}

type APIConf

type APIConf struct {
	Port   string          `yaml:"port,omitempty"`
	Cors   bool            `yaml:"cors"`
	Middle map[string]bool `yaml:"middle,omitempty"`
	Apis   map[string]bool `yaml:"api,omitempty"`
}

func (*APIConf) EnableCORS

func (ac *APIConf) EnableCORS() bool

func (*APIConf) GetPort

func (ac *APIConf) GetPort() string

func (*APIConf) InitAPI

func (ac *APIConf) InitAPI(
	r *mux.Router,
	middles []mid.Middle,
	authMiddle mid.AuthMidInter,
	apis ...API,
)

type APIHandler

type APIHandler struct {
	Path   string
	Next   func(http.ResponseWriter, *http.Request)
	Method string
	Auth   bool
	Group  []auth.UserPerm
}

type ApiDI

type ApiDI interface {
	InitAPI(
		r *mux.Router,
		middles []mid.Middle,
		authMiddle mid.AuthMidInter,
		apis ...API,
	)
	GetPort() string
	EnableCORS() bool
}

type ApiError

type ApiError interface {
	GetStatus() int
	error
}

func NewApiError

func NewApiError(status int, msg string) ApiError

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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