POST request

As of March 2020, School of Haskell has been switched to read-only mode.

{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses,
             TemplateHaskell, OverloadedStrings #-}
import Yesod

data HelloWorld = HelloWorld

mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET POST
|]

instance Yesod HelloWorld

getHomeR :: Handler RepHtml
getHomeR = defaultLayout [whamlet|
                             <form method=post>
                                 <button>POST
                         |]

postHomeR :: Handler RepHtml
postHomeR = defaultLayout [whamlet|This is a post|]

main :: IO ()
main = warpEnv HelloWorld
comments powered by Disqus