modularization

This commit is contained in:
jotty
2026-05-23 21:09:41 +02:00
parent 09146887b2
commit 99b4e06291
2 changed files with 13 additions and 3 deletions
+2 -3
View File
@@ -4,6 +4,7 @@ import (
"net/http" "net/http"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"jottyfan.de/learngin/modules"
) )
type EchoRequest struct { type EchoRequest struct {
@@ -14,9 +15,7 @@ func main() {
r := gin.Default() r := gin.Default()
r.LoadHTMLGlob("templates/*") r.LoadHTMLGlob("templates/*")
r.GET("/ping", func(c *gin.Context) { r.GET("/ping", modules.Ping)
c.JSON(http.StatusOK, gin.H{"message": "pong"})
})
r.GET("/", func(c *gin.Context) { r.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.html", nil) c.HTML(http.StatusOK, "index.html", nil)
+11
View File
@@ -0,0 +1,11 @@
package modules
import (
"net/http"
"github.com/gin-gonic/gin"
)
func Ping(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "pong"})
}