name: apiary
version: 0.11.2
synopsis: Simple web framework inspired by scotty.
description:
Simple web framework inspired by scotty.
.
@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE OverloadedStrings #-}
.
import Web.Apiary
import Network.Wai.Handler.Warp
import qualified Data.ByteString.Lazy.Char8 as L
.
main :: IO ()
main = run 3000 . runApiary def $ do
[capture|/:Int|] . ("name" =: pLazyByteString) . stdMethod GET . action $ \\age name -> do
guard (age >= 18)
contentType "text/html"
lbs . L.concat $ ["<h1>Hello, ", name, "!</h1>\\n"]
@
.
@
$ curl localhost:3000
404 Page Notfound.
$ curl 'localhost:3000/20?name=arice'
<h1>Hello, arice!</h1>
$ curl 'localhost:3000/15?name=bob'
404 Page Notfound.
$ curl -XPOST 'localhost:3000/20?name=arice'
404 Page Notfound.
@
.
* Nestable route handling(Apiary Monad; capture, stdMethod and more.).
.
* type safe route filter.
.
more examples:
license: MIT
license-file: LICENSE
author: HirotomoMoriwaki
maintainer: HirotomoMoriwaki
Homepage: https://github.com/philopon/apiary
Bug-reports: https://github.com/philopon/apiary/issues
copyright: (c) 2014 Hirotomo Moriwaki
category: Web
build-type: Simple
stability: experimental
-- extra-source-files:
cabal-version: >=1.10
flag wai3
description: use wai-3.0
default: True
library
exposed-modules: Web.Apiary
Web.Apiary.Wai
Control.Monad.Apiary
Control.Monad.Apiary.Filter
Control.Monad.Apiary.Filter.Internal
Control.Monad.Apiary.Filter.Internal.Strategy
Control.Monad.Apiary.Action
Data.Apiary.SList
Data.Apiary.Param
other-modules: Control.Monad.Apiary.Internal
Control.Monad.Apiary.Action.Internal
Control.Monad.Apiary.Filter.Internal.Capture
Control.Monad.Apiary.Filter.Internal.Capture.TH
Web.Apiary.TH
other-extensions: KindSignatures
, DataKinds
, TypeOperators
, GADTs
, TypeFamilies
, Rank2Types
build-depends: base >=4.6 && <4.8
, template-haskell >=2.8 && <2.10
, mtl >=2.1 && <2.3
, monad-control >=0.3 && <0.4
, transformers-base >=0.4 && <0.5
, text >=1.1 && <1.2
, bytestring >=0.10 && <0.11
, blaze-builder >=0.3 && <0.4
, data-default-class >=0.0 && <0.1
, reflection >=1.4 && <1.5
, http-types >=0.8 && <0.9
, mime-types >=0.1 && <0.2
, exceptions >=0.6 && <0.7
if impl(ghc < 7.8)
build-depends: tagged >=0.7 && <0.8
if flag(wai3)
build-depends: wai >=3.0 && <3.1
, wai-extra >=3.0 && <3.1
cpp-options: -DWAI3
else
build-depends: wai >=2.1 && <2.2
, wai-extra >=2.1 && <2.2
, conduit >=1.1 && <1.2
hs-source-dirs: src
ghc-options: -O2 -Wall
default-language: Haskell2010
test-suite test-framework
main-is: main.hs
type: exitcode-stdio-1.0
build-depends: base >=4.6 && <4.8
, test-framework >=0.8 && <0.9
, test-framework-hunit >=0.3 && <0.4
, apiary
, bytestring >=0.10 && <0.11
, http-types >=0.8 && <0.9
if flag(wai3)
build-depends: wai >=3.0 && <3.1
, wai-extra >=3.0 && <3.1
else
build-depends: wai >=2.1 && <2.2
, wai-test >=2.0 && <2.1
hs-source-dirs: test
ghc-options: -O2 -Wall -fno-warn-missing-signatures
default-language: Haskell2010
source-repository head
type: git
location: git://github.com/philopon/apiary.git