Skip to content

Instantly share code, notes, and snippets.

@avence12
Created August 31, 2018 10:01
Show Gist options
  • Save avence12/cb35140737a81443c7482175904cb1f8 to your computer and use it in GitHub Desktop.
Save avence12/cb35140737a81443c7482175904cb1f8 to your computer and use it in GitHub Desktop.
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