The scotty-blaze package

[Tags: deprecated, library, mit]

Deprecated

blaze-html integration for Scotty


[Skip to ReadMe]

Properties

Version0.1.3
Change logNone available
Dependenciesbase (==4.*), blaze-builder (>=0.3), blaze-html (>=0.5), mtl (>=2), scotty (>=0.4), wai (>=1.2) [details]
LicenseMIT
AuthorWilliam Casarin
Maintainerwill@casarin.me
CategoryWeb
Source repositoryhead: git clone https://github.com/jb55/scotty-blaze.git
UploadedWed Sep 4 03:51:34 UTC 2013 by WilliamCasarin
DistributionsNixOS:0.1.3
Downloads257 total (11 in last 30 days)
Votes
0 []
StatusDocs uploaded by user
Build status unknown [no reports yet]

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for scotty-blaze-0.1.3

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)