blaze-html integration for scotty
Haskell
Switch branches/tags
Nothing to show
Latest commit c67e79c Sep 4, 2013 @jb55 0.1.3
Permalink
Failed to load latest commit information.
src/Web/Scotty Added readme May 2, 2012
LICENSE Added License Sep 4, 2013
Readme.md Added the only exports to the readme May 2, 2012
Setup.hs Initial commit May 2, 2012
scotty-blaze.cabal 0.1.3 Sep 4, 2013

Readme.md

Web.Scotty.Blaze

blaze-html integration for scotty

Exports

blaze :: Html -> ActionM ()

builder :: Builder -> ActionM ()

Example

{-# LANGUAGE OverloadedStrings #-}

import           Web.Scotty
import           Web.Scotty.Blaze
import           Network.Wai.Middleware.RequestLogger
import           Text.Blaze.Html (Html)
import qualified Text.Blaze.Html5 as H
import qualified Data.Text as T
import           Data.Monoid ((<>))

helloHtml :: T.Text -> Html
helloHtml n =
  H.html $ do
    H.head $ do
      H.title greet
    H.body $ do
      H.p greet
  where
    greet = H.toHtml $ "Hello, " <> n

main :: IO ()
main = scotty 3000 $ do
  middleware logStdoutDev
  get "/:name" $ do
    n <- param "name"
    blaze $ helloHtml (T.pack n)