{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} module Main where import Data.Maybe (fromMaybe) import Data.ByteString.Lazy (ByteString) import Data.Text.Lazy (Text) import Data.Text.Lazy.Encoding (encodeUtf8) import Text.Blaze (Markup) import Text.Blaze.Html (Html) import Text.Blaze.Html.Renderer.Text (renderHtml) import Text.Hamlet (shamlet) import Text.Lucius (lucius, renderCss) import Web.Scotty (ActionM, scotty, get, html, raw, setHeader) import Influencers import System.Environment (lookupEnv) render :: Html -> ActionM () render = html . renderHtml css :: ByteString -> ActionM () css src = setHeader "content-type" "text/css" >> raw src main :: IO () main = do port <- read <$> fromMaybe "3000" <$> lookupEnv "PORT" :: IO Int scotty port routes routes = do get "/" $ render homepage get "/custom.css" $ css stylesheet displayPerson :: Person -> Markup displayPerson person = [shamlet|