on master help sign in
Add the comprehensive api
commit79d18aa8ecb8d3a9ca02d54c4ee3a12b3c54b916 authorDoug Beardsley <mightybyte@gmail.com> dateSat 12 Mar 2016, 17:56 (11 years ago) parenta29373c
2 files changed+26−1
exec/API.hs+25 testserver/Main.hs+1−1
exec/API.hs+25
@@ -15,3 +15,28 @@ type API = "getunit" :> Get '[JSON] ()
1515 :<|> "double" :> ReqBody '[JSON] Double
1616 :> Post '[JSON] Double
1717 :<|> Raw
18+
19+type GET = Get '[JSON] ()
20+
21+-- Imported the comprehensive API example for testing.
22+-- https://github.com/haskell-servant/servant/blob/master/servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs
23+type ComprehensiveAPI =
24+ GET :<|>
25+ Get '[JSON] Int :<|>
26+ Capture "foo" Int :> GET :<|>
27+ Header "foo" Int :> GET :<|>
28+ HttpVersion :> GET :<|>
29+ IsSecure :> GET :<|>
30+ QueryParam "foo" Int :> GET :<|>
31+ QueryParams "foo" Int :> GET :<|>
32+ QueryFlag "foo" :> GET :<|>
33+-- Raw :<|>
34+ RemoteHost :> GET :<|>
35+ ReqBody '[JSON] Int :> GET :<|>
36+ Get '[JSON] (Headers '[Header "foo" Int] ()) :<|>
37+ "foo" :> GET :<|>
38+ Vault :> GET :<|>
39+ Verb 'POST 204 '[JSON] () :<|>
40+ Verb 'POST 204 '[JSON] Int
41+-- This one isn't in scope
42+-- :<|> WithNamedContext "foo" '[] GET
testserver/Main.hs+1−1
@@ -65,7 +65,7 @@ test = serve testApi server
6565initApp :: SnapletInit App App
6666initApp = makeSnaplet "myapp" "example" Nothing $ do
6767 addRoutes [("", applicationToSnap test)
68−-- ,("", serveDirectory "static")
68+ ,("", serveDirectory "static")
6969 ]
7070 return App
7171