Replaced the gin framwwork with echo

This commit is contained in:
2025-01-13 11:57:48 +01:00
parent 8e2d22b899
commit 034ba35fbb
32 changed files with 348 additions and 266 deletions

View File

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