Skip to content

Echo middleware that to add cat facts in headers of HTTP responses.

Notifications You must be signed in to change notification settings

Regentag/cat-facts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cat-facts

Echo middleware that to add cat facts in headers of HTTP responses. Inspired by fabrik42/cat_facts.

Response Headers:
X-Cat-Facts: A cat has 32 muscles in each ear.

All cat facts in this module are from http://maxellah.tripod.com/catfacts.htm.

Example

package main

import (
	"net/http"

	"github.com/labstack/echo/v4"
	catfacts "github.com/regentag/cat-facts"
)

func main() {
	e := echo.New()

	e.Use(catfacts.CatFactsMiddleware)

	e.GET("/", func(c echo.Context) error {
		return c.String(http.StatusOK, "Hello, World!")
	})
	e.Logger.Fatal(e.Start(":1323"))
}

result

Usage

Any URL will have a X-Cat-Fact header in the response, that will contain a random cat fact for your amusement.

About

Echo middleware that to add cat facts in headers of HTTP responses.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages