Export toApplication from Server.

This commit is contained in:
Matthias Fischmann 2015-02-24 13:46:50 +01:00
parent cae0b6e252
commit 1a63d8797a

View file

@ -4,12 +4,14 @@
-- | This module lets you implement 'Server's for defined APIs. You'll -- | This module lets you implement 'Server's for defined APIs. You'll
-- most likely just need 'serve'. -- most likely just need 'serve'.
module Servant.Server module Servant.Server
( -- * Implementing an API ( -- * Run a wai application from an API
serve serve
, -- * Construct a wai Application from an API
toApplication
, -- * Handlers for all standard combinators , -- * Handlers for all standard combinators
HasServer(..) HasServer(..)
) where ) where
import Data.Proxy (Proxy) import Data.Proxy (Proxy)
@ -40,5 +42,10 @@ import Servant.Server.Internal
-- > -- >
-- > main :: IO () -- > main :: IO ()
-- > main = Network.Wai.Handler.Warp.run 8080 app -- > main = Network.Wai.Handler.Warp.run 8080 app
--
-- (If you need access to the wai 'Application' type, use
-- 'toApplication'. This is useful for writing custom servers that do
-- things other than routing (e.g. dumping all requests and responses
-- to a file).)
serve :: HasServer layout => Proxy layout -> Server layout -> Application serve :: HasServer layout => Proxy layout -> Server layout -> Application
serve p server = toApplication (route p server) serve p server = toApplication (route p server)