handlers

package
v1.12.2-beta Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS

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

func Healthz

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

func JSON

func JSON(w http.ResponseWriter, code int, payload interface{})

func Login

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

func Metadata

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

func NodeProxy

func NodeProxy(upstream *httputil.ReverseProxy) func(http.ResponseWriter, *http.Request)

func NotImplemented

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

func Root

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

func StreamJSON

func StreamJSON(c *websocket.Conn, payload interface{})

Types

type DatabaseResponse

type DatabaseResponse struct {
	Connected bool `json:"connected"`
}

type Handlers

type Handlers struct {
}

type HealthzResponse

type HealthzResponse struct {
	Version string         `json:"version"`
	GitSHA  string         `json:"gitSha"`
	Status  StatusResponse `json:"status"`
}

type LoginRequest

type LoginRequest struct {
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"`
}

type MetadataResponse

type MetadataResponse struct {
	IconURI       string `json:"iconUri"`
	Name          string `json:"name"`
	Namespace     string `json:"namespace"`
	IsKurlEnabled bool   `json:"isKurlEnabled"`
}

type SPAHandler

type SPAHandler struct {
	StaticPath string
	IndexPath  string
}

spaHandler implements the http.Handler interface, so we can use it to respond to HTTP requests. The path to the static directory and path to the index file within that static directory are used to serve the SPA in the given static directory.

func (SPAHandler) ServeHTTP

func (h SPAHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP inspects the URL path to locate a file within the static dir on the SPA handler. If a file is found, it will be served. If not, the file located at the index path on the SPA handler will be served. This is suitable behavior for serving an SPA (single page application).

type StatusResponse

type StatusResponse struct {
	Database DatabaseResponse `json:"database"`
	Storage  StorageResponse  `json:"storage"`
}

type StorageResponse

type StorageResponse struct {
	Available bool `json:"available"`
}

Jump to

Keyboard shortcuts

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