Check is now a function

This commit is contained in:
Profitroll 2023-04-14 14:14:17 +02:00
parent 5f72582c92
commit f8ed172666

View File

@ -11,6 +11,12 @@ import (
"github.com/gin-gonic/gin" "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) { func getAvatar(ctx *gin.Context) {
avatar_id := ctx.Param("id") avatar_id := ctx.Param("id")
if _, err := os.Stat("avatars"); errors.Is(err, os.ErrNotExist) { if _, err := os.Stat("avatars"); errors.Is(err, os.ErrNotExist) {
@ -48,11 +54,7 @@ func getAvatar(ctx *gin.Context) {
func main() { func main() {
router := gin.Default() router := gin.Default()
router.GET("/avatars/:id", getAvatar) router.GET("/avatars/:id", getAvatar)
router.GET("/check", func(ctx *gin.Context) { router.GET("/check", check)
ctx.JSON(http.StatusOK, gin.H{
"detail": "I'm alright, thank you",
})
})
host := os.Getenv("HOST") host := os.Getenv("HOST")
port := os.Getenv("PORT") port := os.Getenv("PORT")
if host == "" { if host == "" {