Network.Wai.Middleware.Routed

wai-extra-3.1.17: Provides some basic WAI handlers and middleware.

Safe Haskell | None
Language | Haskell2010

Network.Wai.Middleware.Routed

Description

Since 3.0.9

Synopsis

- routedMiddleware :: ([Text] -> Bool) -> Middleware -> Middleware
- hostedMiddleware :: ByteString -> Middleware -> Middleware

# Documentation

routedMiddleware #

Arguments

:: ([Text] -> Bool) | Only use middleware if this pathInfo test returns True
-> Middleware | middleware to apply the path prefix guard to
-> Middleware | modified middleware

Apply a middleware based on a test of pathInfo

example:

    let corsify = routedMiddleWare ("static" `elem`) addCorsHeaders

Since 3.0.9

hostedMiddleware #

Arguments

:: ByteString | Domain the middleware applies to
-> Middleware | middleware to apply the path prefix guard to
-> Middleware | modified middleware

Only apply the middleware to certain hosts

Since 3.0.9