Created
August 31, 2018 10:01
-
-
Save avence12/cb35140737a81443c7482175904cb1f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
dataapi "myproj/pkg/myapi/data" | |
"net/http" | |
"github.com/gin-gonic/gin" | |
) | |
func main() { | |
router := gin.Default() | |
router.GET("/health", GetHealthHandler) | |
router.GET("/health-dataapi", dataapi.GetDataAPIHealthHandler) | |
s := &http.Server{ | |
Addr: ":8000", | |
Handler: router, | |
} | |
s.ListenAndServe() | |
} | |
// GetHealthHandler - GET /health to expose service health | |
func GetHealthHandler(c *gin.Context) { | |
c.JSON(http.StatusOK, gin.H{ | |
"code": 0, | |
"message": "Service is alive!", | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment