Skip to content

Routes.go

Retroperspect edited this page Dec 18, 2017 · 1 revision

This is the file which stores all possible routes / end points which can be called.
(change or add here to edit all possible routes the api has)

it contains it's general structure like this

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

all routes it contain follow this structure and are as follows

the Index are the basic page, it redirect to status as a convenience.

	Route{
		"Index",
		"GET",
		"/",
		Status,
	},

Join is the command to ask the specified node to start a discussion.

	Route{
		"Join",
		"GET",
		"/join",
		Join,
	},

Leave is a function to make the Node do a safe exit of the network

	Route{
		"Leave queue",
		"GET",
		"/leave",
		UnJoin,
	},

Status shows the current status of the node which details it's connections and if it's in a discussion or not

	Route{
		"Status",
		"GET",
		"/status",
		Status,
	},

Chain is a call for the current block chain of hashvalues.

	Route{
		"Chain",
		"GET",
		"/chain",
		GetChain,
	},

List queue gets the current queue of discussion for user interface purposes

	Route{
		"List Queue",
		"GET",
		"/queue",
		GetQueue,
	},

Sim get acquires the simulated data for user interface purposes

	Route{
		"SIM-Get",
		"GET",
		"/sim",
		GetSimulationData,
	},

Metrics route are designed for prometheus data scrapping and is used for grafana monitoring.

	Route{
		"Metrics",
		"GET",
		"/metrics",
		ServceMetrics,
	},

Clone this wiki locally