Categorygithub.com/bettercode-oss/gin-middleware-etag
modulepackage
0.0.2
Repository: https://github.com/bettercode-oss/gin-middleware-etag.git
Documentation: pkg.go.dev

# README

HTTP ETag Cache Middleware

Gin middleware/handler to enable HTTP Etag support.

Usage

Start using it

Download and install it:

go get github.com/bettercode-oss/gin-middleware-etag

Import it in your code:

import "github.com/bettercode-oss/gin-middleware-etag"

Example

package main

import (
  "github.com/gin-gonic/gin"
  "github.com/bettercode-oss/gin-middleware-etag"
  "net/http"
)

func main() {
  r := gin.Default()
  r.GET("/products", etag.HttpEtagCache(120), getProducts)
  r.Run()
}

func getProducts(c *gin.Context) {
  products := []map[string]any{
    {
        "id":        1,
        "name":      "큰 잔",
        "listPrice": 1000,
    },
    {
        "id":        2,
        "name":      "작은 잔",
        "listPrice": 2000,
    },
  }

  c.JSON(http.StatusOK, products)
}

# Functions

No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author