mirror of
https://github.com/haskell-servant/servant-blaze.git
synced 2024-10-03 19:49:22 +03:00
not really known
.github/workflows | ||
example | ||
src/Servant/HTML | ||
.gitignore | ||
.stylish-haskell.yaml | ||
cabal.haskell-ci | ||
CHANGELOG.md | ||
LICENSE | ||
README.md | ||
servant-blaze.cabal | ||
Setup.hs |
servant-blaze - Blaze-html support for 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 #-}
module Test where
import Servant
import Servant.HTML.Blaze
import qualified Text.Blaze.Html5 as H
type API = Get '[HTML] Homepage
type Homepage = H.Html
server :: Server API
server = return myHome
myHome :: Homepage
myHome = 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"