v1

package
v0.0.0-...-6c16b56 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ValidBearer = "123456"

ValidBearer is a hardcoded bearer token for demonstration purposes.

Variables

This section is empty.

Functions

func GetJSONFile

func GetJSONFile(w http.ResponseWriter, r *http.Request)

GetJSONFile open any file

func GetSystemMeters

func GetSystemMeters(w http.ResponseWriter, r *http.Request)

GetSystemMeters ss

func HelloName

func HelloName(w http.ResponseWriter, r *http.Request)

HelloName returns a personalized JSON message

func HelloWorld

func HelloWorld(w http.ResponseWriter, r *http.Request)

HelloWorld returns a basic "Hello World!" message

func NewRouter

func NewRouter() http.Handler

NewRouter returns an HTTP handler that implements the routes for the API

func RequireAuthentication

func RequireAuthentication(next http.Handler) http.Handler

RequireAuthentication is an example middleware handler that checks for a hardcoded bearer token. This can be used to verify session cookies, JWTs and more.

func ServerResourceStats

func ServerResourceStats(w http.ResponseWriter, r *http.Request)

ServerResourceStats return server resource statat in JSON

func SetJSONFile

func SetJSONFile(w http.ResponseWriter, r *http.Request)

SetJSONFile ff

Types

type FruitBasket

type FruitBasket struct {
	Name  string
	Fruit []string
	// contains filtered or unexported fields
}

FruitBasket dff

type HelloResponse

type HelloResponse struct {
	Message string `json:"message"`
}

HelloResponse is the JSON representation for a customized message

type ServerStats

type ServerStats struct {
	HostName         string
	Uptime           string
	NumOfProcess     string
	CPUUsed          string
	MemoryUsed       string
	DiskUsed         string
	NetworkBytesSent string
	NetworkBytesRead string
	RxBytes          string
	TxBytes          string
}

ServerStats define rerun fields

Jump to

Keyboard shortcuts

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