The webapp package

[maintain]
Warnings:

See README.md


[Skip to ReadMe]

Properties

Versions0.0.1, 0.0.2, 0.1.0, 0.1.1, 0.1.2, 0.2.0, 0.2.0, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6
Dependenciesaeson, base (>=4.8.0.0 && <=4.8.1.0), base16-bytestring, blaze-builder, bytestring, case-insensitive, http-types, mtl, network, optparse-applicative, regex-posix, stm, streaming-commons, text, transformers, unix, wai, warp, warp-tls, zlib [details]
LicenseMIT
Copyright(c) 2015 Nathaniel Symer
AuthorNathaniel Symer <nate@symer.io>
MaintainerNathaniel Symer <nate@symer.io>
Stabilityexperimental
CategoryWeb
Home pagehttps://github.com/fhsjaagshs/webapp
Bug trackerhttps://github.com/fhsjaagshs/webapp/issues
Source repositoryhead: git clone git://github.com/fhsjaagshs/webapp.git
UploadedMon Jan 18 21:07:24 UTC 2016 by natesymer

Modules

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for webapp-0.2.0

webapp - WAI web framework

Webapp is a web framework that is designed to provide everything needed to define & deploy a web app.

Basic example:

module Main where

import Web.App
import qualified Control.Monad.State.Class as S

instance WebAppState Integer where
  initState = return 0
  destroyState st = do
    putStr "Counted: "
    print st

main = webappMainIO' app "My Web App"

app :: WebAppT Integer IO ()
app = do
  get "/" $ do
    addHeader "Content-Type" "text/plain"
    S.get >>= writeBody . show

  get "/add" $ do
    S.state (((),) . (+) 1)
    redirect "/"
    
  get "/subtract" $ do
    S.get >>= S.put . ((-) 1)
    redirect "/"