The webapp package

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[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, 0.4.0, 0.4.1, 0.5.0, 0.6.0, 0.6.1
Change logCHANGELOG.md
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>
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 "/"