webwire-0.1.0: Functional reactive web framework

MaintainerErtugrul Soeylemez <es@ertes.de>

WebWire.Routing

Contents

Description

Routing functionality.

Synopsis

Routing

directory :: Text -> WebWire site a b -> WebWire site a bSource

If the request root segment is the given directory, then removes the root segment and adds it to the current path for the given wire.

file :: Text -> WebWire site a b -> WebWire site a bSource

If the request root segment is the given file and there are no more segments, then removes the last segment and adds it to the current path for the given wire.

rootDir :: WebWire site a b -> WebWire site a bSource

Run the given wire, if the current request path is empty. Otherwise inhibit with 404.

Redirecting

redirect :: RedirectType -> WebWire site Text bSource

Redirect to the input URI. Inhibits with the appropriate exception.

redirectRaw :: RedirectType -> WebWire site Text bSource

Redirect to the input URI. Inhibits with the appropriate exception.

seeOther :: WebWire site Text bSource

Convenience interface to redirect for the very common 303 redirection.

seeOtherRaw :: WebWire site Text bSource

Convenience interface to redirect for the very common 303 redirection.

Paths

cdIn :: WebWire site a ()Source

Remove the root request segment and add it to the current path. Inhibits with a 404 error, if the request path is empty.

cdOut :: WebWire site a ()Source

Remove the current tail segment and add it to the request path. Inhibits with a 404 error, if the current path is empty.

currentDir :: WebWire site a (Maybe Text)Source

Output the current path segment, if there is one. Outputs Nothing, if there are no further path segments. In particular, if the root path is requested, this wire always returns Nothing.

currentPath :: WebWire site a [Text]Source

Output the current rest of the path segment.

pathAbs :: WebWire site [Text] TextSource

Construct the full URI to the given path from the root path.

pathRel :: WebWire site [Text] TextSource

Construct the full URI to the given path from the current path.

requestDir :: WebWire site a (Maybe Text)Source

Output the root request path segment, if there is one. Outputs Nothing, if there are no further path segments. In particular, if the root path is requested, this wire always returns Nothing.

requestPath :: WebWire site a [Text]Source

Output the rest of the request path segment.

rootPath :: WebWire site a [Text]Source

Output the current root path.

setRoot :: WebWire site [Text] ()Source

Set the current root path. This wire also resets the current path.