wai-dispatch (empty) → 0.1
raw patch · 5 files changed
+77/−0 lines, 5 filesdep +basedep +textdep +waisetup-changed
Dependencies added: base, text, wai, yesod-routes
Files
- COPYING +13/−0
- Network/Wai/Dispatch.hs +16/−0
- README +6/−0
- Setup.hs +3/−0
- wai-dispatch.cabal +39/−0
+ COPYING view
@@ -0,0 +1,13 @@+Copyright © 2012, Stephen Paul Weber <singpolyma.net>++Permission to use, copy, modify, and/or distribute this software for any+purpose with or without fee is hereby granted, provided that the above+copyright notice and this permission notice appear in all copies.++THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ Network/Wai/Dispatch.hs view
@@ -0,0 +1,16 @@+-- | Simple module to wrap yesod-routes for use with WAI+module Network.Wai.Dispatch (dispatch, Route(..), Piece(..)) where++import Data.Maybe (fromMaybe)+import Network.Wai (Application, Request(pathInfo, requestMethod))+import Yesod.Routes.Dispatch (Route(..), Piece(..), toDispatch)+import Data.Text (toUpper)+import Data.Text.Encoding (decodeUtf8)++dispatch :: Application -- ^ Default 'Application' (likely 404)+ -> [Route Application] -- ^ Routes+ -> Application+dispatch defaultApp routes env = app env+ where+ app = fromMaybe defaultApp (toDispatch routes routeOn)+ routeOn = toUpper (decodeUtf8 $ requestMethod env) : pathInfo env
+ README view
@@ -0,0 +1,6 @@+Provides a simple wrapper for taking Route data mapping to WAI+'Application's and a default 'Application' and producing a single+'Application'.++You may find the route-generator package useful for generating route+data to use with this library.
+ Setup.hs view
@@ -0,0 +1,3 @@+import Distribution.Simple++main = defaultMain
+ wai-dispatch.cabal view
@@ -0,0 +1,39 @@+name: wai-dispatch+version: 0.1+cabal-version: >= 1.8+license: OtherLicense+license-file: COPYING+category: Web+copyright: © 2012 Stephen Paul Weber+author: Stephen Paul Weber <singpolyma@singpolyma.net>+maintainer: Stephen Paul Weber <singpolyma@singpolyma.net>+stability: experimental+tested-with: GHC == 7.0.3+synopsis: Nice wrapper around yesod-routes for use with WAI+homepage: https://github.com/singpolyma/wai-dispatch+bug-reports: https://github.com/singpolyma/wai-dispatch/issues+build-type: Simple+description:+ Provides a simple wrapper for taking Route data mapping to WAI+ 'Application's and a default 'Application' and producing a single+ 'Application'.+ .+ You may find the route-generator package useful for generating route+ data to use with this library.++extra-source-files:+ README++library+ exposed-modules:+ Network.Wai.Dispatch++ build-depends:+ base == 4.*,+ text >= 0.7,+ yesod-routes,+ wai++source-repository head+ type: git+ location: git://github.com/singpolyma/wai-dispatch.git