modularization

This commit is contained in:
jotty committed 2026-05-23 21:09:41 +02:00
1 parent 09146887b2
commit 99b4e06291
2 files changed
+13 -3

No files matched your search

+2 -3
View File
@@ -4,6 +4,7 @@ import (
"net/http"
"github.com/gin-gonic/gin"
"jottyfan.de/learngin/modules"
)
type EchoRequest struct {
@@ -14,9 +15,7 @@ func main() {
r := gin.Default()
r.LoadHTMLGlob("templates/*")
r.GET("/ping", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "pong"})
})
r.GET("/ping", modules.Ping)
r.GET("/", func(c *gin.Context) {
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"})
}