-
-
Save friedbrice/d81f6692a845287bd67f4891e8a52761 to your computer and use it in GitHub Desktop.
Hello world Yesod example.
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 TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings #-} | |
import Yesod | |
import Yesod.Core.Handler | |
data HelloWorld = HelloWorld | |
mkYesod "HelloWorld" [parseRoutes| | |
/ HomeR GET | |
|] | |
instance Yesod HelloWorld | |
content = take (3 * 1024) $ repeat 'a' | |
getHomeR :: Handler RepHtml | |
getHomeR = hamletToRepHtml [hamlet| | |
$doctype 5 | |
<html lang="en"> | |
<head> | |
<body> | |
<p>#{content} | |
|] | |
main :: IO () | |
main = warp 3000 HelloWorld |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment