f9b1e7fc50
Instead of directly interpreting a server as a `RoutingApplication`, this change introduces the concept of a `Router`, which is a datatype with several constructors. In particular, the type of the `route` function changes from route :: Proxy layout -> Server layout -> RoutingApplication to route :: Proxy layout -> IO (RouteResult (Server layout)) -> Router Most important in practice is the case of the `StaticRouter` constructor in `Router`. For choices between statically known paths, we can now use a lookup table to dispatch requests rather than trying each request individually. This brings down routing complexity of a common case from O(n) to O(log n). Another important change is that the handler that is passed down by `route` is no longer of type `Server layout`, but of type `IO (RouteResult (Server layout))`. This means that API constructs can "delay" checks and failure. For example, `ReqBody` does not have to fetch the request body and feed it to the handler immediately; it can instead record these actions in the handler that is passed down. The code will only be executed at a leaf / endpoint of the API. This is desired behaviour: We prefer to save work by doing all matching on static path components first. Furthermore, we get better error codes by doing so.
124 lines
3.5 KiB
Text
124 lines
3.5 KiB
Text
name: servant-server
|
|
version: 0.4.1
|
|
synopsis: A family of combinators for defining webservices APIs and serving them
|
|
description:
|
|
A family of combinators for defining webservices APIs and serving them
|
|
.
|
|
You can learn about the basics in the <http://haskell-servant.github.io/tutorial tutorial>.
|
|
.
|
|
<https://github.com/haskell-servant/servant/blob/master/servant-server/example/greet.hs Here>
|
|
is a runnable example, with comments, that defines a dummy API and implements
|
|
a webserver that serves this API, using this package.
|
|
.
|
|
<https://github.com/haskell-servant/servant/blob/master/servant-server/CHANGELOG.md CHANGELOG>
|
|
homepage: http://haskell-servant.github.io/
|
|
Bug-reports: http://github.com/haskell-servant/servant/issues
|
|
license: BSD3
|
|
license-file: LICENSE
|
|
author: Alp Mestanogullari, Sönke Hahn, Julian K. Arni
|
|
maintainer: alpmestan@gmail.com
|
|
copyright: 2014 Zalora South East Asia Pte Ltd
|
|
category: Web
|
|
build-type: Simple
|
|
cabal-version: >=1.10
|
|
tested-with: GHC >= 7.8
|
|
extra-source-files:
|
|
CHANGELOG.md
|
|
README.md
|
|
source-repository head
|
|
type: git
|
|
location: http://github.com/haskell-servant/servant-server.git
|
|
|
|
|
|
library
|
|
exposed-modules:
|
|
Servant
|
|
Servant.Server
|
|
Servant.Server.Internal
|
|
Servant.Server.Internal.ServantErr
|
|
Servant.Server.Internal.Enter
|
|
Servant.Utils.StaticFiles
|
|
build-depends:
|
|
base >= 4.7 && < 5
|
|
, aeson >= 0.7 && < 0.9
|
|
, attoparsec >= 0.12 && < 0.14
|
|
, bytestring >= 0.10 && < 0.11
|
|
, containers >= 0.5 && < 0.6
|
|
, either >= 4.3 && < 4.5
|
|
, http-types >= 0.8 && < 0.9
|
|
, network-uri >= 2.6 && < 2.7
|
|
, mtl >= 2 && < 3
|
|
, mmorph >= 1
|
|
, safe >= 0.3 && < 0.4
|
|
, servant == 0.4.*
|
|
, split >= 0.2 && < 0.3
|
|
, string-conversions >= 0.3 && < 0.4
|
|
, system-filepath >= 0.4 && < 0.5
|
|
, filepath >= 1
|
|
, text >= 1.2 && < 1.3
|
|
, transformers >= 0.3 && < 0.5
|
|
, wai >= 3.0 && < 3.1
|
|
, wai-app-static >= 3.0 && < 3.2
|
|
, warp >= 3.0 && < 3.1
|
|
hs-source-dirs: src
|
|
default-language: Haskell2010
|
|
ghc-options: -Wall
|
|
|
|
executable greet
|
|
main-is: greet.hs
|
|
hs-source-dirs: example
|
|
ghc-options: -Wall
|
|
default-language: Haskell2010
|
|
build-depends:
|
|
base
|
|
, servant
|
|
, servant-server
|
|
, aeson
|
|
, warp
|
|
, wai
|
|
, text
|
|
|
|
test-suite spec
|
|
type: exitcode-stdio-1.0
|
|
ghc-options:
|
|
-Wall -fno-warn-name-shadowing -fno-warn-missing-signatures
|
|
default-language: Haskell2010
|
|
hs-source-dirs: test
|
|
main-is: Spec.hs
|
|
build-depends:
|
|
base == 4.*
|
|
, aeson
|
|
, bytestring
|
|
, bytestring-conversion
|
|
, directory
|
|
, either
|
|
, exceptions
|
|
, hspec == 2.*
|
|
, hspec-wai
|
|
, http-types
|
|
, network >= 2.6
|
|
, QuickCheck
|
|
, parsec
|
|
, servant
|
|
, servant-server
|
|
, string-conversions
|
|
, temporary
|
|
, text
|
|
, transformers
|
|
, mtl
|
|
, wai
|
|
, wai-extra
|
|
, warp
|
|
|
|
test-suite doctests
|
|
build-depends: base
|
|
, servant
|
|
, doctest
|
|
, filemanip
|
|
, directory
|
|
, filepath
|
|
type: exitcode-stdio-1.0
|
|
main-is: test/Doctests.hs
|
|
buildable: True
|
|
default-language: Haskell2010
|
|
ghc-options: -threaded
|