@hackage apiary0.4.3.2

Simple web framework inspired by scotty.

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