svc

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NullEndpoint

func NullEndpoint(c *gin.Context)

NullEndpoint just respondes with an empty 200

func RobotsEndpoint

func RobotsEndpoint(c *gin.Context)

RobotsEndpoint maps to GET /robots.txt

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

Types

type APIService

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

APIService abstracts an API endpoint

func New

func New(addr ...string) (*APIService, error)

New creates a new service instance on addr

func (*APIService) AddDefaultEndpoints

func (api *APIService) AddDefaultEndpoints()

AddDefaultEndpoints adds a couple of simple handlers to the router

func (*APIService) Router

func (api *APIService) Router() *gin.Engine

Router gives access to the router instance

func (*APIService) ServeStaticAssets

func (api *APIService) ServeStaticAssets(path, dir string)

ServeStaticAssets adds handlers to serve static assets

func (*APIService) Start

func (api *APIService) Start()

Start attaches the router to a server

Jump to

Keyboard shortcuts

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