favicon

package module
v0.0.0-...-0951e12 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2016 License: MIT Imports: 6 Imported by: 0

README

favicon

Build Status Coverage Status

Go http middleware for serving the favicon.

Installation

go get -u github.com/go-http-utils/favicon

Documentation

API documentation can be found here: https://godoc.org/github.com/go-http-utils/favicon

Usage

import (
  "github.com/go-http-utils/favicon"
)
mux := http.NewServeMux()
mux.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
  res.Write([]byte("Hello World"))
})

http.ListenAndServe(":8080", favicon.Handler(mux, "./public/favicon.ico"))

Documentation

Overview

Example
package main

import (
	"net/http"

	"github.com/go-http-utils/favicon"
)

func main() {
	mux := http.NewServeMux()
	mux.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
		res.Write([]byte("Hello World"))
	})

	http.ListenAndServe(":8080", favicon.Handler(mux, "./public/favicon.ico"))
}

Index

Examples

Constants

View Source
const Version = "0.1.0"

Version is this package's version.

Variables

This section is empty.

Functions

func Handler

func Handler(h http.Handler, path string) http.Handler

Handler wraps the http.Handler h with favicon support. `path` is the path to find the favicon.

Types

This section is empty.

Jump to

Keyboard shortcuts

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