(Feat): Initial Commit
This commit is contained in:
21
internal/api/handlers/common/get_version.go
Normal file
21
internal/api/handlers/common/get_version.go
Normal file
@@ -0,0 +1,21 @@
|
||||
// nolint:revive
|
||||
package common
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"allaboutapps.dev/aw/go-starter/internal/api"
|
||||
"allaboutapps.dev/aw/go-starter/internal/config"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
func GetVersionRoute(s *api.Server) *echo.Route {
|
||||
return s.Router.Management.GET("/version", getVersionHandler(s))
|
||||
}
|
||||
|
||||
// Returns the version and build date baked into the binary.
|
||||
func getVersionHandler(_ *api.Server) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
return c.String(http.StatusOK, config.GetFormattedBuildArgs())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user