Files
MusicServer/pkg/api/index.go

29 lines
524 B
Go

package api
import (
"music-server/pkg/server"
"net/http"
"github.com/labstack/echo"
)
type Index struct {
}
func NewIndex() *Index {
return &Index{}
}
func (i *Index) GetVersion(ctx echo.Context) error {
versionHistory := server.GetVersionHistory()
if versionHistory.Version == "" {
return ctx.JSON(http.StatusNotFound, "version not found")
}
return ctx.JSON(http.StatusOK, versionHistory)
}
func (i *Index) GetDBTest(ctx echo.Context) error {
server.TestDB()
return ctx.JSON(http.StatusOK, "TestedDB")
}