Skip to content

Commit 92c3baa

Browse files
committed
feat(agent): add version and ping endpoint
1 parent 972bcb2 commit 92c3baa

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

agent/api_server.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ func startHttpServer() {
3737
}
3838
})
3939

40+
// General API
41+
e.GET("/ping", getPing)
42+
e.GET("/version", getVersion)
43+
4044
// Volume API
4145
e.GET("/volumes", fetchAllVolumes)
4246
e.GET("/volumes/:uuid", fetchVolume)

agent/ping_api.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package main
2+
3+
import (
4+
"net/http"
5+
6+
"github.com/labstack/echo/v4"
7+
)
8+
9+
func getPing(c echo.Context) error {
10+
return c.JSON(http.StatusOK, Response{
11+
Message: "Successfully fetched ping",
12+
Data: "pong",
13+
})
14+
}

agent/version.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package main
2+
3+
import (
4+
"net/http"
5+
6+
"github.com/labstack/echo/v4"
7+
)
8+
9+
const Version = "0.0.1"
10+
11+
func getVersion(c echo.Context) error {
12+
return c.JSON(http.StatusOK, Response{
13+
Message: "Successfully fetched version",
14+
Data: Version,
15+
})
16+
}

0 commit comments

Comments
 (0)