A library for communicate with HTTP protocol.
go get github.com/hokkung/srv
- Prepair a customizer to register a route
type ServerCustomizer struct {
}
func (c *ServerCustomizer) Register(s *server.Server) {
s.Engine.GET("/ping", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "pong",
})
})
}
- Create a server and start
customizer := ServerCustomizer{}
server := server.NewServer(customizer)
s.Start()
Key | Description | Example |
---|---|---|
APP_SERVER_ADDR | Port to start HTTP server | :8080 (default) |