Skip to content

Instantly share code, notes, and snippets.

@slogsdon
Created July 27, 2015 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slogsdon/90894130b7f3dc9b565e to your computer and use it in GitHub Desktop.
Save slogsdon/90894130b7f3dc9b565e to your computer and use it in GitHub Desktop.
{-#LANGUAGE OverloadedStrings #-}
module Main where
import Data.Monoid
import Data.Text (Text, pack)
import Web.Spock.Safe
main :: IO ()
main =
runSpock 3000 $ spockT id $
do get root $
text "Hello World"
get var getPost
get ("hello" <//> var) $ \name ->
text ("Hello" <> name <> "!")
getPost slug = text $ do
contents <- readFile $ "./pub/assets/md/" <> slug <> ".md"
return $ pack contents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment