feat: Add Gin framework to various packages, introducing new server structure with separate service registries for general nodes, map nodes, and reduce nodes.

This commit is contained in:
2025-02-11 14:20:00 +01:00
parent de07752466
commit 12e6c65727
13 changed files with 211 additions and 4 deletions

24
pkg/general-node/node.go Normal file
View File

@@ -0,0 +1,24 @@
package generalnode
import "github.com/gin-gonic/gin"
func Start() {
router := gin.Default()
// Get Status
router.GET("/status", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
// Add Service
router.POST("/service", func(c *gin.Context) {
c.JSON(200, gin.H{
"serviceName": "service1",
"status": "registered",
})
})
router.Run() // listen and serve on 0.0.0.0:8080
}

View File

@@ -0,0 +1 @@
package generalnode

13
pkg/map-node/node.go Normal file
View File

@@ -0,0 +1,13 @@
package mapnode
import "github.com/gin-gonic/gin"
func Start() {
router := gin.Default()
router.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
router.Run() // listen and serve on 0.0.0.0:8080
}

13
pkg/reduce-node/node.go Normal file
View File

@@ -0,0 +1,13 @@
package reducenode
import "github.com/gin-gonic/gin"
func Start() {
router := gin.Default()
router.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
router.Run() // listen and serve on 0.0.0.0:8080
}