server

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthGet added in v0.1.0

func HealthGet(ctx *fasthttp.RequestCtx)

HealthGet is the health handler (always return 200)

Types

type API

type API struct {
	Name      string               `json:"name"`
	Lock      bool                 `json:"lock"`
	Token     []string             `json:"token,omitempty"`
	Generator *generator.Generator `json:"generator,omitempty"`
}

API represents an API access point

type Instance

type Instance struct {
	Router *fasthttprouter.Router
	API    map[string]API
}

Instance is a structure that stores the router

func (*Instance) AddAPI added in v0.1.0

func (i *Instance) AddAPI(ctx *fasthttp.RequestCtx)

AddAPI adds an API endpoint

func (*Instance) AddSeed added in v0.1.0

func (i *Instance) AddSeed(ctx *fasthttp.RequestCtx)

AddSeed adds a seed to a specific api endpoint note that duplicate seed is explicitly allowed in order to allow for increasing odds as well as to allow some names to pop up twice

func (*Instance) GetInfoAPI added in v0.1.0

func (i *Instance) GetInfoAPI(ctx *fasthttp.RequestCtx)

GetInfoAPI returns informations about a specific API

func (*Instance) GetPetname added in v0.1.0

func (i *Instance) GetPetname(ctx *fasthttp.RequestCtx)

GetPetname returns petname when queried

func (*Instance) ReloadAPI added in v0.1.0

func (i *Instance) ReloadAPI(ctx *fasthttp.RequestCtx)

ReloadAPI cleans the Used binary tree for a specific API

func (*Instance) RemoveSeed added in v0.1.0

func (i *Instance) RemoveSeed(ctx *fasthttp.RequestCtx)

RemoveSeed removes a seed to a specific api endpoint

func (*Instance) SetupAPI

func (i *Instance) SetupAPI(name string, lock bool, template string) bool

SetupAPI sets up an API

func (*Instance) SetupRouter

func (i *Instance) SetupRouter()

SetupRouter generates the initial router configurations for the petname API server

func (*Instance) Start

func (i *Instance) Start(port int)

Start loads router configuration and starts the http listening

Jump to

Keyboard shortcuts

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