The apiary package

[Tags: library, mit]

Simple and type safe web framework that can be automatically generate API documentation.

{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE OverloadedStrings #-}

import Web.Apiary
import Network.Wai.Handler.Warp
import qualified Data.ByteString.Lazy.Char8 as L

main :: IO ()
main = server (run 3000) . runApiary def $ do
  [capture|/:Int|] . ("name" =: pLazyByteString) . method GET . action $ \age name -> do
      guard (age >= 18)
      contentType "text/html"
      mapM_ lazyBytes ["<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.

more examples: https://github.com/philopon/apiary/blob/v0.16.0/examples/


Properties

Versions0.1.0.0, 0.1.0.1, 0.2.0.0, 0.3.0.0, 0.3.1.0, 0.3.2.0, 0.4.0.0, 0.4.0.1, 0.4.0.2, 0.4.2.0, 0.4.3.0, 0.4.3.1, 0.4.3.2, 0.5.0.0, 0.5.1.0, 0.6.0.0, 0.6.0.1, 0.6.1.0, 0.7.0.0, 0.8.0.0, 0.9.0.0, 0.10.0, 0.11.0, 0.11.1, 0.11.2, 0.11.3, 0.12.0, 0.12.1, 0.12.2, 0.12.3, 0.12.4, 0.12.5, 0.12.6, 0.12.7, 0.12.8, 0.13.0, 0.14.0, 0.14.0.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0 (info)
Dependenciesbase (>=4.6 && <4.8), blaze-builder (==0.3.*), blaze-html (==0.7.*), blaze-markup (==0.6.*), bytestring (==0.10.*), bytestring-lexing (==0.4.*), case-insensitive (>=1.1 && <1.3), conduit (==1.1.*), data-default-class (==0.0.*), exceptions (==0.6.*), hashable (>=1.1 && <1.3), http-types (==0.8.*), mime-types (==0.1.*), monad-control (==0.3.*), mtl (>=2.1 && <2.3), template-haskell (>=2.8 && <2.10), text (==1.1.*), time (==1.4.*), transformers (>=0.2 && <0.5), transformers-base (==0.4.*), unordered-containers (==0.2.*), wai (==2.1.*), wai-extra (==2.1.*) or
base (>=4.6 && <4.8), blaze-builder (==0.3.*), blaze-html (==0.7.*), blaze-markup (==0.6.*), bytestring (==0.10.*), bytestring-lexing (==0.4.*), case-insensitive (>=1.1 && <1.3), data-default-class (==0.0.*), exceptions (==0.6.*), hashable (>=1.1 && <1.3), http-types (==0.8.*), mime-types (==0.1.*), monad-control (==0.3.*), mtl (>=2.1 && <2.3), template-haskell (>=2.8 && <2.10), text (==1.1.*), time (==1.4.*), transformers (>=0.2 && <0.5), transformers-base (==0.4.*), unordered-containers (==0.2.*), wai (==3.0.*), wai-extra (==3.0.*)
LicenseMIT
Copyright(c) 2014 Hirotomo Moriwaki
AuthorHirotomoMoriwaki<philopon.dependence@gmail.com>
MaintainerHirotomoMoriwaki<philopon.dependence@gmail.com>
Stabilityexperimental
CategoryWeb
Home pagehttps://github.com/philopon/apiary
Bug trackerhttps://github.com/philopon/apiary/issues
Source repositoryhead: git clone git://github.com/philopon/apiary.git
Upload dateFri Aug 29 22:54:43 UTC 2014
Uploaded byHirotomoMoriwaki
Downloads1589 total (173 in last 30 days)

Modules

[Index]

Flags

NameDescriptionDefault
wai3use wai-3.0Enabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainers' corner

For package maintainers and hackage trustees