Categorygithub.com/appleboy/gin-revision-middleware
modulepackage
0.0.0-20160722161421-cc548e45b51a
Repository: https://github.com/appleboy/gin-revision-middleware.git
Documentation: pkg.go.dev

# README

gin-revision-middleware

Revision middleware for Gin framework written in Go (Golang).

Build Status Build Status Go Report Card Coverage Status codecov

How to use

Please see the demo code and creat REVISION file and write your application version into file.

package main

import (
  "github.com/appleboy/gin-revision-middleware"
  "github.com/gin-gonic/gin"
  "net/http"
  "os"
)

func rootHandler(context *gin.Context) {
  context.JSON(http.StatusOK, gin.H{
    "Hello": "world",
  })
}

func main() {
  port := os.Getenv("PORT")
  router := gin.Default()
  if port == "" {
    port = "8000"
  }
  router.Use(revision.Middleware())
  router.GET("/", rootHandler)
  router.Run(":" + port)
}

Screenshot for header

header screenshot

# Packages

No description provided by the author

# Functions

GetRevision will get revision string from file.
Middleware will auto set Revision on header.