https://github.com/lwch/executiontime
gin框架ExecutionTime组件
https://github.com/lwch/executiontime
Last synced: 2 months ago
JSON representation
gin框架ExecutionTime组件
- Host: GitHub
- URL: https://github.com/lwch/executiontime
- Owner: lwch
- License: mit
- Created: 2023-01-10T09:49:16.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-03-10T02:33:26.000Z (about 2 years ago)
- Last Synced: 2025-01-03T17:30:54.407Z (4 months ago)
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ExecutionTime
Execution Time middleware for gin framework.- Adds an handler cost time using the `X-Execution-Time` header.
## Install
```shell
go get github.com/lwch/executiontime
```## Usage
```go
package mainimport (
"net/http""github.com/gin-gonic/gin"
"github.com/lwch/executiontime"
)func main() {
h := gin.Default()h.Use(
executiontime.New(),
)// Example ping request.
h.GET("/ping", func(g *gin.Context) {
g.JSON(http.StatusOK, gin.H{"ping": "pong"})
})h.Run()
}
```