From f8ed17266657e4783e62ffa835f1fb549c2fd057 Mon Sep 17 00:00:00 2001 From: profitroll Date: Fri, 14 Apr 2023 14:14:17 +0200 Subject: [PATCH] Check is now a function --- holochecker_api.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/holochecker_api.go b/holochecker_api.go index 026d5e3..dfd6435 100644 --- a/holochecker_api.go +++ b/holochecker_api.go @@ -11,6 +11,12 @@ import ( "github.com/gin-gonic/gin" ) +func check(ctx *gin.Context) { + ctx.JSON(http.StatusOK, gin.H{ + "detail": "I'm alright, thank you", + }) +} + func getAvatar(ctx *gin.Context) { avatar_id := ctx.Param("id") if _, err := os.Stat("avatars"); errors.Is(err, os.ErrNotExist) { @@ -48,11 +54,7 @@ func getAvatar(ctx *gin.Context) { func main() { router := gin.Default() router.GET("/avatars/:id", getAvatar) - router.GET("/check", func(ctx *gin.Context) { - ctx.JSON(http.StatusOK, gin.H{ - "detail": "I'm alright, thank you", - }) - }) + router.GET("/check", check) host := os.Getenv("HOST") port := os.Getenv("PORT") if host == "" {