scotty-blaze: blaze-html integration for Scotty

[ deprecated, library, mit, web ] [ Propose Tags ]
Deprecated

blaze-html integration for Scotty


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.3
Dependencies base (>=4 && <5), blaze-builder (>=0.3), blaze-html (>=0.5), mtl (>=2), scotty (>=0.4), wai (>=1.2) [details]
License MIT
Author William Casarin
Maintainer will@casarin.me
Category Web
Source repo head: git clone https://github.com/jb55/scotty-blaze.git
Uploaded by WilliamCasarin at 2013-09-04T03:51:34Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1180 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for scotty-blaze-0.1.3

[back to package description]

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)