webgear-server-1.3.1: Composable, type-safe library to build HTTP API servers
Safe HaskellSafe-Inferred
LanguageHaskell2010

WebGear.Server

Description

Main module for WebGear server.

Import this module to get all required types and functions to build a WebGear server. Alternatively, import individual modules under WebGear.Server.

Typical usage to implement a server is:

 import WebGear.Server
 import Network.Wai (Application)
 import qualified Network.Wai.Handler.Warp as Warp

 -- | A monad stack for you application
 type App a = ....

 -- | Convert the App monad to IO
 runApp :: App a -> IO a
 runApp = ....

 -- | Handler for the server
 myHandler :: Handler h App => RequestHandler h '[]
 myHandler = ....

 app :: Application
 app = toApplication (transform runApp myHandler)

 main :: IO ()
 main = Warp.run port app

Documentation