handlers

package
v0.0.0-...-5073c34 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package handlers contains the HTTP server along with the requests and routes. All HTTP related functions are in this package.

More info on: https://github.com/hunterlong/statup

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DesktopInit

func DesktopInit(ip string, port int)

DesktopInit will run the Statup server on a specific IP and port using SQLite database

func IsAuthenticated

func IsAuthenticated(r *http.Request) bool

IsAuthenticated returns true if the HTTP request is authenticated. You can set the environment variable GO_ENV=test to bypass the admin authenticate to the dashboard features.

func Router

func Router() *mux.Router

Router returns all of the routes used in Statup

func RunHTTPServer

func RunHTTPServer(ip string, port int) error

RunHTTPServer will start a HTTP server on a specific IP and port

Types

type Cacher

type Cacher interface {
	Get(key string) []byte
	Delete(key string)
	Set(key string, content []byte, duration time.Duration)
}
var CacheStorage Cacher

type Item

type Item struct {
	Content    []byte
	Expiration int64
}

Item is a cached reference

func (Item) Expired

func (item Item) Expired() bool

Expired returns true if the item has expired.

type PluginSelect

type PluginSelect struct {
	Plugin string
	Form   string
	Params map[string]interface{}
}

type Storage

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

Storage mecanism for caching strings in memory

func NewStorage

func NewStorage() *Storage

NewStorage creates a new in memory CacheStorage

func (Storage) Delete

func (s Storage) Delete(key string)

func (Storage) Get

func (s Storage) Get(key string) []byte

Get a cached content by key

func (Storage) Set

func (s Storage) Set(key string, content []byte, duration time.Duration)

Set a cached content by key

Jump to

Keyboard shortcuts

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