webapp: Haskell web scaffolding using Scotty, WAI, and Warp

[ library, mit, web ] [ Propose Tags ] [ Report a vulnerability ]
This version is deprecated.

See README.md


[Skip to Readme]

Modules

  • Web
    • Web.App
      • Web.App.Assets
      • Web.App.Cookie
      • Web.App.Daemon
      • Web.App.FileCache
      • Web.App.HTTP
      • Web.App.IO
      • Web.App.Monad
      • Web.App.Password

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0.1, 0.0.2, 0.1.0, 0.1.1, 0.1.2, 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 (info)
Dependencies attoparsec, base (>=4.8.0.0 && <=4.8.1.0), base16-bytestring, bcrypt, blaze-builder, bytestring, cryptohash, css-text, data-default, directory, filepath, fsnotify, hashtables, hjsmin, http-types, mime-types, mtl, optparse-applicative, scotty, stm, text, time, transformers, unix, unordered-containers, wai, wai-extra, warp, warp-tls, zlib [details]
License MIT
Copyright (c) 2015 Nathaniel Symer
Author Nathaniel Symer <nate@symer.io>
Maintainer Nathaniel Symer <nate@symer.io>
Category Web
Home page https://github.com/fhsjaagshs/webapp
Bug tracker https://github.com/fhsjaagshs/webapp/issues
Source repo head: git clone git://github.com/fhsjaagshs/webapp.git
Uploaded by natesymer at 2015-12-01T04:01:25Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 7591 total (23 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-11-29 [all 3 reports]

Readme for webapp-0.0.1

[back to package description]

webapp - simple webapp scaffolding with state

Basic example:

module Main where

import Web.App
import Web.Scotty.Trans

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

main = webappMain app "My Web App" "This is a demo web app"

app :: (ScottyError e) => ScottyT e (WebAppM Integer) ()
app = do
  get "/add" $ do
  	modifyState (+1)
    
  get "/subtract" $ do
    (State count) <- getState
    putState (State count-1)
    
  get "/assets/:file" $ param "file" >>= loadAsset

There is also a module called FileCache which is available for loading cached files. It loads files into memory, MD5 sums them, compresses them, and then stores them in the cache.