mirror of
https://github.com/ilyakooo0/servant-reflex.git
synced 2024-10-26 02:11:36 +03:00
Add the comprehensive api
This commit is contained in:
parent
a29373c993
commit
79d18aa8ec
25
exec/API.hs
25
exec/API.hs
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user