Categorygithub.com/lwch/executiontime
modulepackage
1.0.1
Repository: https://github.com/lwch/executiontime.git
Documentation: pkg.go.dev

# README

ExecutionTime

Execution Time middleware for gin framework.

  • Adds an handler cost time using the X-Execution-Time header.

Install

go get github.com/lwch/executiontime

Usage

package main

import (
	"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()
}

# Packages

No description provided by the author

# Functions

No description provided by the author
WithCustomHeaderStrKey set custom header key for execution time.

# Type aliases

Option for execution time.