Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/hokkung/srv
- Owner: hokkung
- Created: 2023-08-18T22:49:48.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-04T22:09:48.000Z (11 months ago)
- Last Synced: 2024-05-07T09:17:14.576Z (6 months ago)
- Topics: gin-gonic, golang, unit-testing
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
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)