Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
Handler provides JSON API response giving service information
Example ¶
ExampleHandler is a usage example for info.Handler
package main import ( "github.com/skillcoder/go-common-handlers/info" "github.com/takama/router" ) func main() { r := router.New() version := "1.0.0" repo := "go-common-handlers" commit := "356a192b7913b04c54574d18c28d46e6395428ab" r.GET("/info", info.Handler(version, repo, commit)) r.Listen(":3000") }
Output:
Types ¶
type RuntimeInfo ¶
type RuntimeInfo struct { Compiler string `json:"compilier"` CPU int `json:"cpu"` Memory string `json:"memory"` Goroutines int `json:"goroutines"` Uptime string `json:"uptime"` }
RuntimeInfo defines runtime part of service information
type ServiceInfo ¶
type ServiceInfo struct { Host string `json:"host"` Version string `json:"version"` Repo string `json:"repo"` Commit string `json:"commit"` Build string `json:"build"` Runtime *RuntimeInfo `json:"runtime"` }
ServiceInfo defines HTTP API response giving service information
Click to show internal directories.
Click to hide internal directories.