29 lines
577 B
Go
29 lines
577 B
Go
package server
|
|
|
|
import (
|
|
"music-server/internal/backend"
|
|
"net/http"
|
|
|
|
"github.com/labstack/echo"
|
|
)
|
|
|
|
type IndexHandler struct {
|
|
}
|
|
|
|
func NewIndexHandler() *IndexHandler {
|
|
return &IndexHandler{}
|
|
}
|
|
|
|
func (i *IndexHandler) GetVersion(ctx echo.Context) error {
|
|
versionHistory := backend.GetVersionHistory()
|
|
if versionHistory.Version == "" {
|
|
return ctx.JSON(http.StatusNotFound, "version not found")
|
|
}
|
|
return ctx.JSON(http.StatusOK, versionHistory)
|
|
}
|
|
|
|
func (i *IndexHandler) GetDBTest(ctx echo.Context) error {
|
|
backend.TestDB()
|
|
return ctx.JSON(http.StatusOK, "TestedDB")
|
|
}
|