gin显示favicon

  sre, 开发

5fd8bb3bdc0cc8933.jpg_fo742.png

package main

import (
    "github.com/gin-gonic/gin"
    "github.com/thinkerou/favicon"
)

func main() {
    app := gin.Default()
    app.Use(favicon.New("./favicon.ico")) // 运行目录下的favicon.ico
    app.GET("/ping", func(c *gin.Context) {
        c.String(200, "Hello favicon.")
    })
    app.Run(":8080")
}


One Reply to “gin显示favicon”

LEAVE A COMMENT

Captcha Code