mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-03-02 01:50:18 +00:00
- add swagger definitions for all API routes - self-host the swagger UI on `/swagger/` - serve swagger spec on `/swagger.json`
23 lines
484 B
Go
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)
|
|
}
|