Created
July 31, 2018 02:08
-
-
Save waddlaw/ab5ee9a1f6be80ddc452a7b66cc526f4 to your computer and use it in GitHub Desktop.
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
#!/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