haskell-servant/servant-blaze

Name: servant-blaze

Owner: servant

Description: null

Created: 2016-05-13 07:23:19.0

Updated: 2018-03-22 11:23:56.0

Pushed: 2018-03-22 11:23:55.0

Homepage: null

Size: 24

Language: Haskell

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

servant-lucid - Blaze-html support for servant

servant

This package allows you to use blaze-html to serve html pages in your servant APIs. More specifically, it exports a HTML datatype with the correct MimeRender instances so that you can write type API = Get '[HTML] User for example.

Minimal example:
LANGUAGE OverloadedStrings, DataKinds #-}

le Test where

rt           Servant
rt           Servant.HTML.Blaze
rt qualified Text.Blaze.Html5   as H

 API = Get '[HTML] Homepage
 Homepage = H.Html

er :: Server API
er = return myHome

me :: Homepage
me = H.docTypeHtml $ do
H.head $ do
         H.title "Live to serve"
H.body $ do
         H.h1 "Templates!"
         H.p "This will be type-checked, rendered and served"

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.