wai-middleware-clacks-0.1.0.0: GNU Terry Pratchett - Add the X-Clacks-Overhead Header to Wai Responses.

Safe HaskellNone
LanguageHaskell2010

Network.Wai.Middleware.Clacks

Description

The Clacks middleware adds a X-Clacks-Overhead header to every response served by a Wai server.

To use this package to keep the legacy of Terry Pratchett alive, simply pass your wai application to clacks gnuTerryPratchett before passing it to the run function:

import Network.Wai.Handler.Warp (run)
import Network.Wai.Middleware.Clacks (clacks, gnuTerryPratchett)

import MyLib.App (myApp)

main :: IO ()
main = run 8080 $ clacks gnuTerryPratchett myApp

You can use the Clacks type to build a custom configuration for the clacks function, allowing you to pass anything into the header:

import Data.List.NonEmpty (NonEmpty(..))
import Network.Wai (Middleware)
import Network.Wai.Middleware.Clacks (Clacks(..), clacks)

myClacks :: Middleware
myClacks = clacks $ Clacks $ "GNU Ada Lovelace" :| ["GNU Hoban Washburne", "GNU Shephard Book"]

For more information about the Clacks or the X-Clacks-Overhead header, check out the GNU Terry Pratchett website.

Synopsis

Documentation

clacks :: Clacks -> Middleware Source #

A Network.Wai Middleware that adds a X-Clacks-Overhead header containing the messages in the Clacks configuration.

newtype Clacks Source #

Configuration for the Clacks WAI Middleware.

Constructors

Clacks 

Fields

Instances
Eq Clacks Source # 
Instance details

Defined in Network.Wai.Middleware.Clacks

Methods

(==) :: Clacks -> Clacks -> Bool #

(/=) :: Clacks -> Clacks -> Bool #

Read Clacks Source # 
Instance details

Defined in Network.Wai.Middleware.Clacks

Show Clacks Source # 
Instance details

Defined in Network.Wai.Middleware.Clacks

gnuTerryPratchett :: Clacks Source #

Sends a Clacks message of GNU Terry Pratchett.

clacksHeaderName :: HeaderName Source #

The name of the Clacks header.