refactor: general-node and map-node to use flotte types for service registration
This commit is contained in:
@@ -3,11 +3,17 @@ package reducenode
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
func Start() {
|
||||
err := registerAsReduceNode()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
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
|
||||
router = registerRoutes(router)
|
||||
|
||||
router.Run("localhost:4001") // listen and serve on 0.0.0.0:4001
|
||||
}
|
||||
|
||||
func registerAsReduceNode() error {
|
||||
return nil
|
||||
}
|
||||
|
14
internal/reduce-node/routes.go
Normal file
14
internal/reduce-node/routes.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package reducenode
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
func registerRoutes(router *gin.Engine) *gin.Engine {
|
||||
|
||||
router.GET("/ping", func(c *gin.Context) {
|
||||
c.JSON(200, gin.H{
|
||||
"message": "pong",
|
||||
})
|
||||
})
|
||||
|
||||
return router
|
||||
}
|
Reference in New Issue
Block a user