Add the comprehensive api

This commit is contained in:
Doug Beardsley 2016-03-12 17:56:13 +08:00
parent a29373c993
commit 79d18aa8ec
2 changed files with 26 additions and 1 deletions

View File

@ -15,3 +15,28 @@ type API = "getunit" :> Get '[JSON] ()
:<|> "double" :> ReqBody '[JSON] Double
:> Post '[JSON] Double
:<|> Raw
type GET = Get '[JSON] ()
-- Imported the comprehensive API example for testing.
-- https://github.com/haskell-servant/servant/blob/master/servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs
type ComprehensiveAPI =
GET :<|>
Get '[JSON] Int :<|>
Capture "foo" Int :> GET :<|>
Header "foo" Int :> GET :<|>
HttpVersion :> GET :<|>
IsSecure :> GET :<|>
QueryParam "foo" Int :> GET :<|>
QueryParams "foo" Int :> GET :<|>
QueryFlag "foo" :> GET :<|>
-- Raw :<|>
RemoteHost :> GET :<|>
ReqBody '[JSON] Int :> GET :<|>
Get '[JSON] (Headers '[Header "foo" Int] ()) :<|>
"foo" :> GET :<|>
Vault :> GET :<|>
Verb 'POST 204 '[JSON] () :<|>
Verb 'POST 204 '[JSON] Int
-- This one isn't in scope
-- :<|> WithNamedContext "foo" '[] GET

View File

@ -65,7 +65,7 @@ test = serve testApi server
initApp :: SnapletInit App App
initApp = makeSnaplet "myapp" "example" Nothing $ do
addRoutes [("", applicationToSnap test)
-- ,("", serveDirectory "static")
,("", serveDirectory "static")
]
return App