@hackage apiary0.4.3.2
Simple web framework inspired by scotty.
Categories
License
MIT
Maintainer
HirotomoMoriwaki<philopon.dependence@gmail.com>
Links
Versions
Installation
Dependencies (16)
- base >=4.6 && <4.8
- blaze-builder >=0.3 && <0.4
- bytestring >=0.10 && <0.11
- conduit >=1.1 && <1.2
- data-default-class >=0.0 && <0.1
- http-types >=0.8 && <0.9 Show all…
Dependents (15)
@hackage/apiary-memcached, @hackage/apiary-persistent, @hackage/apiary-mongoDB, @hackage/apiary-cookie, @hackage/apiary-session, @hackage/acme-everything, Show all…
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|] . queryFirst' "name" . stdMethod GET . action $ \age name -> do
guard (age >= 18)
contentType "text/html"
lbs . L.concat $ ["<h1>Hello, ", L.fromStrict name, "!</h1>"]
Nestable route handling(ApiaryT Monad; capture, stdMethod and more.).
type safe route filter.
full example & tutorial: https://github.com/philopon/apiary/blob/master/examples/main.lhs