favicon

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(iconpath string) gear.Middleware

New creates a favicon middleware to serve favicon from the provided directory.

package main

import (
	"github.com/teambition/gear"
	"github.com/teambition/gear/middleware/favicon"
)

func main() {
	app := gear.New()
	app.Use(favicon.New("./testdata/favicon.ico"))
	app.Use(func(ctx *gear.Context) error {
		return ctx.HTML(200, "<h1>Hello, Gear!</h1>")
	})
	app.Error(app.Listen(":3000"))
}

func NewWithIco added in v0.19.0

func NewWithIco(file []byte, times ...time.Time) gear.Middleware

NewWithIco creates a favicon middleware with ico file and a optional modTime.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL