Reorganized the code, moved more things to the new part
This commit is contained in:
28
internal/server/indexHandler.go
Normal file
28
internal/server/indexHandler.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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")
|
||||
}
|
||||
Reference in New Issue
Block a user