happstack-server-7.1.7: Web related tools and services.

Portability | GHC-only, Windows, Linux, FreeBSD, OS X
Stability | provisional
Maintainer | Happstack team <happs@googlegroups.com>
Safe Haskell | None

Happstack.Server

Contents

- HTTP Server
- Request Routing
- Creating Responses
- Looking up values in Query String, Request Body, and Cookies
- Create and Set Cookies (see also Happstack.Server.RqData)
- File Serving
- HTTP Realm Authentication
- Error Handling
- I18N
- Web-related Monads
- Proxying
- Output Validation
- HTTP Types
- Other

Description

Happstack.Server provides a self-contained HTTP server and a rich collection of types and functions for routing Requests, generating Responses, working with query parameters, form data, and cookies, serving files and more.

A very simple, "Hello World!" web app looks like:

     import Happstack.Server
     main = simpleHTTP nullConf $ ok "Hello World!"

By default the server will listen on port 8000. Run the app and point your browser at: http://localhost:8000/

At the core of the Happstack server we have the `simpleHTTP` function which starts the HTTP server:

     simpleHTTP :: ToMessage a => Conf -> ServerPart a -> IO ()

and we have the user supplied `ServerPart` (also known as, `ServerPartT` `IO`), which generates a `Response` for each incoming `Request`.

A trivial HTTP app server might just take a user supplied function like:

     myApp :: Request -> IO Response

For each incoming `Request` the server would fork a new thread, run `myApp` to generate a `Response`, and then send the `Response` back to the client. But, that would be a pretty barren wasteland to work in.

The model for `ServerPart` is essential the same, except we use the much richer `ServerPart` monad instead of the `IO` monad.

For in-depth documentation and runnable examples I highly recommend The Happstack Crash Course http://happstack.com/docs/crashcourse/index.html.

Synopsis

- module Happstack.Server.SimpleHTTP
- module Happstack.Server.Routing
- module Happstack.Server.Response
- module Happstack.Server.RqData
- module Happstack.Server.Cookie
- module Happstack.Server.FileServe
- module Happstack.Server.Auth
- module Happstack.Server.Error
- module Happstack.Server.I18N
- module Happstack.Server.Monads
- module Happstack.Server.Proxy
- module Happstack.Server.Validation
- module Happstack.Server.Types
- module Happstack.Server.Client

# HTTP Server

module Happstack.Server.SimpleHTTP

# Request Routing

module Happstack.Server.Routing

# Creating Responses

module Happstack.Server.Response

# Looking up values in Query String, Request Body, and Cookies

module Happstack.Server.RqData

# Create and Set Cookies (see also Happstack.Server.RqData)

module Happstack.Server.Cookie

# File Serving

module Happstack.Server.FileServe

# HTTP Realm Authentication

module Happstack.Server.Auth

# Error Handling

module Happstack.Server.Error

# I18N

module Happstack.Server.I18N

# Web-related Monads

module Happstack.Server.Monads

# Proxying

module Happstack.Server.Proxy

# Output Validation

module Happstack.Server.Validation

# HTTP Types

module Happstack.Server.Types

# Other

module Happstack.Server.Client