Files
podinfo/pkg/api/version.go
stefanprodan 2479134e78 Implement swagger support
- add swagger definitions for all API routes
- self-host the swagger UI on `/swagger/`
- serve swagger spec on `/swagger.json`
2019-08-07 14:17:35 +03:00

23 lines
484 B
Go

package api
import (
"net/http"
"github.com/stefanprodan/podinfo/pkg/version"
)
// Version godoc
// @Summary Version
// @Description returns podinfo version and git commit hash
// @Tags HTTP API
// @Produce json
// @Router /version [get]
// @Success 200 {object} api.MapResponse
func (s *Server) versionHandler(w http.ResponseWriter, r *http.Request) {
result := map[string]string{
"version": version.VERSION,
"commit": version.REVISION,
}
s.JSONResponse(w, r, result)
}