http-server-1.0.3: A library for writing Haskell web servers.

Portability
Stabilityprovisional
Maintainerdiatchki@galois.com
Safe HaskellNone

Network.HTTP.Server

Description

 

Synopsis

Documentation

server :: HStream a => Handler a -> IO ()Source

Start a server with the default configuration, and the given handler. Requests are handled in separate threads.

serverWith :: HStream a => Config -> Handler a -> IO ()Source

Start a server with the given configuration and handler. Requests are handled in separate threads.

type Handler a = SockAddr -> URL -> Request a -> IO (Response a)Source

Handlers invoked to process requests. The type parameter is for the type of the payload in the body. It is a variation on string of some sort (e.g., String, ByteString, etc.)

data Config Source

Server configuration.

Constructors

Config 

Fields

srvLog :: Logger

Server reports what's going on here.

srvHost :: HostName

Host name to bind to.

srvPort :: PortNumber

Port to listen on.

defaultConfig :: ConfigSource

Some default options for a server: no logging output, listen on "localhost:8000".

data Request a

Constructors

Request 

Fields

rqURI :: URI
 
rqMethod :: RequestMethod
 
rqHeaders :: [Header]
 
rqBody :: a
 

Instances

Show (Request a) 
HasHeaders (Request a) 

data Response a

Constructors

Response 

Fields

rspCode :: ResponseCode
 
rspReason :: String
 
rspHeaders :: [Header]
 
rspBody :: a
 

Instances

Show (Response a) 
HasHeaders (Response a)