mirror of
https://github.com/shouptech/tempgopher.git
synced 2026-02-03 16:49:42 +00:00
Group api components
This commit is contained in:
parent
cfa7fc7fe8
commit
c817f27eb2
1 changed files with 10 additions and 11 deletions
21
web.go
21
web.go
|
|
@ -124,17 +124,16 @@ func SetupRouter(config *Config, states *map[string]State) *gin.Engine {
|
||||||
// Ping
|
// Ping
|
||||||
r.GET("/ping", PingHandler)
|
r.GET("/ping", PingHandler)
|
||||||
|
|
||||||
// Status
|
// API Endpoints
|
||||||
r.GET("/api/status", StatusHandler(states))
|
api := r.Group("/api")
|
||||||
r.GET("/api/status/*alias", StatusHandler(states))
|
{
|
||||||
|
api.GET("/status", StatusHandler(states))
|
||||||
// API Version
|
api.GET("/status/*alias", StatusHandler(states))
|
||||||
r.GET("/api/version", VersionHandler)
|
api.GET("/version", VersionHandler)
|
||||||
|
api.GET("/config", ConfigHandler(config))
|
||||||
// Config
|
api.GET("/config/sensors/*alias", ConfigHandler(config))
|
||||||
r.GET("/api/config", ConfigHandler(config))
|
api.POST("/config/sensors", UpdateSensorsHandler)
|
||||||
r.GET("/api/config/sensors/*alias", ConfigHandler(config))
|
}
|
||||||
r.POST("/api/config/sensors", UpdateSensorsHandler)
|
|
||||||
|
|
||||||
// App
|
// App
|
||||||
r.GET("/jsconfig.js", JSConfigHandler(config))
|
r.GET("/jsconfig.js", JSConfigHandler(config))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue