@hackage apiary0.1.0.0

Simple web framework inspired by scotty.

Simple web framework inspired by scotty.

{-# LANGUAGE QuasiQuotes 125;
{-# LANGUAGE OverloadedStrings 125;

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

main :: IO ()
main = run 3000 . runApiaryT def $ do
  [capture|/:String|] $ do
    stdMethod GET . action $ \name -> do
      contentType "text/html"
      lbs . L.concat $ ["<h1>Hello, ", L.pack name, "!</h1>"]
  • Nestable route handling(ApiaryT Monad; capture, stdMethod and more.).

  • type safe path capture.

full example & tutorial: https://github.com/philopon/apiary/blob/master/examples/main.lhs