package web import ( "net/http" "github.com/gin-gonic/gin" ) // Server is the exposed struct that contains necessary configuration and setup // to run the web server. type Server struct { router *gin.Engine } // NewServer returns a configured instance of the web server. func NewServer() *Server { router := gin.Default() router.GET("/ping", ping) return &Server{ router: router, } } // ping is a dummy function to see if things are running well enough. func ping(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"message": "pong"}) } // Run runs our server! func (s *Server) Run() { s.router.Run() }