server

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package server provides the HTTP server and endpoints.

Index

Constants

This section is empty.

Variables

View Source
var API = Routes{
	Secure: map[string]Handlers{},
	Insecure: map[string]Handlers{
		http.MethodGet: map[string]Handler{
			"/ping":   endpoint.Ping,
			"/coffee": endpoint.Coffee,
		},
		http.MethodPost: map[string]Handler{
			"/send": endpoint.Send,
		},
	},
}

API for the bot HTTP endpoints.

Functions

func Listen

func Listen(port int, handler http.Handler) error

Listen on the given port for HTTP requests.

func Router

func Router(routes Routes, settings config.Settings) http.Handler

Router builds the http router providing secure and insecure sub routers and limiters on both.

Types

type Handler

type Handler func(settings config.Settings) http.HandlerFunc

Handler types can generate a HandlerFunc for the given settings.

type Handlers

type Handlers map[string]Handler

Handlers defines a set of Gorilla URL paths and their Handler.

type Routes

type Routes struct {
	Secure   map[string]Handlers
	Insecure map[string]Handlers
}

Routes allows the API to be defined.

Directories

Path Synopsis
Package endpoint contains all the HTTP endpoints.
Package endpoint contains all the HTTP endpoints.

Jump to

Keyboard shortcuts

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