packages feed

wai-routes-0.4.0: wai-routes.cabal

Name:                wai-routes
Version:             0.4.0
Synopsis:            Typesafe URLs for Wai applications.
Homepage:            https://github.com/ajnsit/wai-routes
License:             MIT
License-file:        LICENSE
Author:              Anupam Jain
Maintainer:          ajnsit@gmail.com
Build-Type:          Simple
Cabal-Version:       >=1.6
stability:           Experimental
Category:            Network
Extra-source-files:  README.md, examples/Example.hs
Description:
  Provides easy to use typesafe URLs for Wai Applications.
  .
  Sample usage follows (See examples/Example.hs in the source bundle for the full code) -
  .
  @
    {-# LANGUAGE OverloadedStrings, TypeFamilies #-}
    .
    import Network.Wai
    import Network.Wai.Middleware.Routes
    .
    import Data.IORef
    .
    -- The Site Argument
    data MyRoute = MyRoute (IORef DB)
    .
    -- Generate Routes
    mkRoute "MyRoute" [parseRoutes|
    /             UsersR         GET
    /user/#Int    UserR:
      /              UserRootR   GET
      /delete        UserDeleteR POST
    |]
    .
    -- Define Handlers
    -- All Users Page
    getUsersR :: Handler MyRoute
    getUsersR (MyRoute dbref) request = ...
    -- Single User Page
    getUserRootR :: Int -> Handler MyRoute
    getUserRootR userid (MyRoute dbref) request = ...
    -- Delete Single User
    postUserDeleteR :: Int -> Handler MyRoute
    postUserDeleteR userid (MyRoute dbref) request = ...
    .
    -- Define Application using RouteM Monad
    myApp = do
    &#32;&#32;db <- liftIO &#36; newIORef mydb
    &#32;&#32;route (MyRoute db)
    &#32;&#32;setDefaultAction $ staticApp $ defaultFileServerSettings &#34;static&#34;
    .
    &#45;&#45; Run the application
    main &#58;&#58; IO ()
    main = toWaiApp myApp >>= run 8080
  @

source-repository head
  type:     git
  location: http://github.com/ajnsit/wai-routes

source-repository this
  type:     git
  location: http://github.com/ajnsit/wai-routes/tree/v0.4.0
  tag:      v0.4.0

Library
  hs-source-dirs:    src
  Build-Depends:     base >= 3 && < 5
               ,     wai >= 2 && < 2.1
               ,     text >= 0.11.3 && < 0.12
               ,     bytestring >= 0.10.0 && < 0.10.1
               ,     http-types >= 0.8.3 && < 0.8.4
               ,     blaze-builder >= 0.3.3 && < 0.3.4
               ,     template-haskell >= 2.8.0 && < 2.8.1
               ,     yesod-routes >= 1.2.0 && < 1.2.1
               ,     mtl
  exposed-modules:   Network.Wai.Middleware.Routes
               ,     Network.Wai.Middleware.Routes.Routes
               ,     Network.Wai.Middleware.Routes.Monad
               ,     Network.Wai.Middleware.Routes.Handler
               ,     Network.Wai.Middleware.Routes.ContentTypes