https://github.com/thinkerou/favicon
Gin middleware to support favicon.
https://github.com/thinkerou/favicon
favicon gin middleware
Last synced: 12 months ago
JSON representation
Gin middleware to support favicon.
- Host: GitHub
- URL: https://github.com/thinkerou/favicon
- Owner: thinkerou
- License: mit
- Created: 2017-07-10T13:46:47.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-07-24T06:16:48.000Z (almost 3 years ago)
- Last Synced: 2025-02-01T02:33:47.188Z (over 1 year ago)
- Topics: favicon, gin, middleware
- Language: Go
- Homepage:
- Size: 40 KB
- Stars: 35
- Watchers: 3
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Favicon Gin's middleware
Gin middleware to support favicon.
## Usage
### Start using it
Download and install it:
```sh
$ go get github.com/thinkerou/favicon
```
Import it in your code:
```go
import "github.com/thinkerou/favicon"
```
### Canonical example:
```go
package main
import (
"github.com/gin-gonic/gin"
"github.com/thinkerou/favicon"
)
func main() {
r := gin.Default()
r.Use(favicon.New("./favicon.ico")) // set favicon middleware
r.GET("/ping", func(c *gin.Context) {
c.String(200, "Hello favicon.")
})
r.Run(":8080")
}
```