svc

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// NamespacePrefix is the common namespace prefix of API releated routes
	NamespacePrefix string = "/a/1"
	// CronNamespacePrefix is the namespace for all scheduler routes
	CronNamespacePrefix = "/_c/1"
	// WorkerNamespacePrefix is the namespace for all worker routes
	WorkerNamespacePrefix = "/_w/1"
)

Variables

This section is empty.

Functions

func AddDefaultEndpoints added in v0.0.2

func AddDefaultEndpoints()

AddDefaultEndpoints adds a couple of simple handlers to the router

func DELETE added in v0.0.2

func DELETE(relativePath string, handler gin.HandlerFunc)

DELETE is a shortcut for router.Handle("DELETE", path, handle).

func GET added in v0.0.2

func GET(relativePath string, handler gin.HandlerFunc)

GET is a shortcut for router.Handle("GET", path, handle).

func GetRequiredScopes added in v0.0.2

func GetRequiredScopes(c *gin.Context) string

GetRequiredScopes returns the required scopes/scopes for this request or an empty string if none are required

func Group added in v0.0.2

func Group(relativePath string) *gin.RouterGroup

Group creates a new router group

func HEAD(relativePath string, handler gin.HandlerFunc)

HEAD is a shortcut for router.Handle("HEAD", path, handle).

func NullEndpoint

func NullEndpoint(c *gin.Context)

NullEndpoint just respondes with an empty 200

func OPTIONS added in v0.0.2

func OPTIONS(relativePath string, handler gin.HandlerFunc)

OPTIONS is a shortcut for router.Handle("OPTIONS", path, handle).

func PATCH added in v0.0.2

func PATCH(relativePath string, handler gin.HandlerFunc)

PATCH is a shortcut for router.Handle("PATCH", path, handle).

func POST added in v0.0.2

func POST(relativePath string, handler gin.HandlerFunc)

POST is a shortcut for router.Handle("POST", path, handle).

func PUT added in v0.0.2

func PUT(relativePath string, handler gin.HandlerFunc)

PUT is a shortcut for router.Handle("PUT", path, handle).

func RobotsEndpoint

func RobotsEndpoint(c *gin.Context)

RobotsEndpoint maps to GET /robots.txt

func ServeStaticAssets added in v0.0.2

func ServeStaticAssets(path, dir string)

ServeStaticAssets adds handlers to serve static assets

func StandardAPIResponse

func StandardAPIResponse(c *gin.Context, err error)

StandardAPIResponse is the default way to respond to API requests

func StandardJSONResponse

func StandardJSONResponse(c *gin.Context, res interface{}, err error)

StandardJSONResponse is the default way to respond to API requests

func StandardNoRouteResponse added in v0.0.2

func StandardNoRouteResponse(c *gin.Context)

StandardNoRouteResponse is the default response to unknown routes

func StandardNotAuthorizedResponse added in v0.11.1

func StandardNotAuthorizedResponse(c *gin.Context)

StandardNotAuthorizedResponse is the default response to unknown routes

func Start added in v0.0.2

func Start()

Start attaches the router to a server. This function blocks!

func Use added in v0.0.2

func Use(handler gin.HandlerFunc)

Use adds a middleware to the router

Types

type APIService

type APIService struct {
	// contains filtered or unexported fields
}

APIService abstracts an API endpoint

type SecureRouterGroup added in v0.0.2

type SecureRouterGroup struct {
	// contains filtered or unexported fields
}

SecureRouterGroup wraps a gin.RouterGroup and adds metadata for request authorization

func SecureGroup added in v0.0.2

func SecureGroup(relativePath string, secureHandler gin.HandlerFunc) *SecureRouterGroup

SecureGroup creates a new router group with a security handler

func (*SecureRouterGroup) DELETE added in v0.0.2

func (srg *SecureRouterGroup) DELETE(relativePath, scope string, handler gin.HandlerFunc)

DELETE is a shortcut for router.Handle("DELETE", path, handle).

func (*SecureRouterGroup) GET added in v0.0.2

func (srg *SecureRouterGroup) GET(relativePath, scope string, handler gin.HandlerFunc)

GET is a shortcut for router.Handle("GET", path, handle).

func (*SecureRouterGroup) HEAD added in v0.0.2

func (srg *SecureRouterGroup) HEAD(relativePath, scope string, handler gin.HandlerFunc)

HEAD is a shortcut for router.Handle("HEAD", path, handle).

func (*SecureRouterGroup) OPTIONS added in v0.0.2

func (srg *SecureRouterGroup) OPTIONS(relativePath, scope string, handler gin.HandlerFunc)

OPTIONS is a shortcut for router.Handle("OPTIONS", path, handle).

func (*SecureRouterGroup) PATCH added in v0.0.2

func (srg *SecureRouterGroup) PATCH(relativePath, scope string, handler gin.HandlerFunc)

PATCH is a shortcut for router.Handle("PATCH", path, handle).

func (*SecureRouterGroup) POST added in v0.0.2

func (srg *SecureRouterGroup) POST(relativePath, scope string, handler gin.HandlerFunc)

POST is a shortcut for router.Handle("POST", path, handle).

func (*SecureRouterGroup) PUT added in v0.0.2

func (srg *SecureRouterGroup) PUT(relativePath, scope string, handler gin.HandlerFunc)

PUT is a shortcut for router.Handle("PUT", path, handle).

Jump to

Keyboard shortcuts

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