servant

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: MIT Imports: 9 Imported by: 0

README

Go Report Build Status

Servant

prepare

Install task with: sudo snap install task --classic

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Enabled bool
	Users   []User
}

type Config

type Config struct {
	Host     string
	Port     int
	Loglevel string
	TLS      bool
	CertPath string
	KeyPath  string
}

Config holds the general config for servant

type Route

type Route struct {
	Endpoint string
	Method   string
	Auth     Auth
	Function func() string
}

func NewRoute

func NewRoute(endpoint string, method string, auth Auth, function func() string) Route

func (Route) Serve

func (route Route) Serve(w http.ResponseWriter, r *http.Request)

type Servant

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

Servant is the servant object

func NewServant

func NewServant(config Config, routes []Route) Servant

NewServant creates a new servant instance

func (*Servant) Summon

func (s *Servant) Summon()

Summon starts the servant instance to listen

type User

type User struct {
	Name           string
	PasswordSha512 string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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