Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hokkung/srv

Internal library for communication with HTTP protocol for Golang application
https://github.com/hokkung/srv

gin-gonic golang unit-testing

Last synced: about 4 hours ago
JSON representation

Internal library for communication with HTTP protocol for Golang application

Awesome Lists containing this project

README

        

# Srv
A library for communicate with HTTP protocol.

## Installation
```
go get github.com/hokkung/srv
```

## Getting Started
1. 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",
})
})
}
```
2. Create a server and start
```
customizer := ServerCustomizer{}
server := server.NewServer(customizer)
s.Start()
```

## Environment Configuration ##
| Key | Description | Example |
| --- | ----------- | ------- |
| APP_SERVER_ADDR | Port to start HTTP server | :8080 (default)