Skip to content

Instantly share code, notes, and snippets.

@waddlaw
Created July 31, 2018 02:08
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 waddlaw/ab5ee9a1f6be80ddc452a7b66cc526f4 to your computer and use it in GitHub Desktop.
Save waddlaw/ab5ee9a1f6be80ddc452a7b66cc526f4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env stack
-- stack script --resolver lts-12.4
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
import Yesod
data App = App
mkYesod "App" [parseRoutes|
/ HomeR GET
|]
instance Yesod App
getHomeR :: Handler Html
getHomeR = defaultLayout $ do
mname <- lookupGetParam "name"
[whamlet|
$maybe name <- mname
<img onload="init('#{name}')" src="https://www.yesodweb.com/static/logo-home2-no-esod-smaller2.png">
$nothing
No setting parameter.
|]
toWidget [julius|
function init(text) {
// anything
}
|]
main :: IO ()
main = warp 3000 App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment