Replaced the gin framwwork with echo
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user