Last active
December 19, 2015 20:49
-
-
Save co-dan/6015894 to your computer and use it in GitHub Desktop.
Working on scotty-hastache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
<html> <head> | |
<title></title> | |
</head> | |
<body> | |
<h1>Scotty, {{action}} me up!</h1> | |
<hr> | |
<address></address> | |
<!-- hhmts start --><!-- hhmts end --> | |
</body> </html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Text.Hastache | |
import Web.Scotty as S | |
import Web.Scotty.Hastache | |
main :: IO () | |
main = scottyH' 3000 $ do | |
setTemplatesDir "/home/vagrant/dev/" | |
-- ^ Setting up the director with templates | |
get "/:word" $ do | |
beam <- param "word" | |
setH "action" $ MuVariable (beam :: String) | |
-- ^ "action" will be binded to the contents of 'beam' | |
hastache "greet.html" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Replace Main.hs
import Web.Scotty as S
by
import Web.Scotty.Trans as S