mirror of
https://github.com/shouptech/tempgopher.git
synced 2026-02-03 08:39:43 +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
|
||||
r.GET("/ping", PingHandler)
|
||||
|
||||
// Status
|
||||
r.GET("/api/status", StatusHandler(states))
|
||||
r.GET("/api/status/*alias", StatusHandler(states))
|
||||
|
||||
// API Version
|
||||
r.GET("/api/version", VersionHandler)
|
||||
|
||||
// Config
|
||||
r.GET("/api/config", ConfigHandler(config))
|
||||
r.GET("/api/config/sensors/*alias", ConfigHandler(config))
|
||||
r.POST("/api/config/sensors", UpdateSensorsHandler)
|
||||
// API Endpoints
|
||||
api := r.Group("/api")
|
||||
{
|
||||
api.GET("/status", StatusHandler(states))
|
||||
api.GET("/status/*alias", StatusHandler(states))
|
||||
api.GET("/version", VersionHandler)
|
||||
api.GET("/config", ConfigHandler(config))
|
||||
api.GET("/config/sensors/*alias", ConfigHandler(config))
|
||||
api.POST("/config/sensors", UpdateSensorsHandler)
|
||||
}
|
||||
|
||||
// App
|
||||
r.GET("/jsconfig.js", JSConfigHandler(config))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue