Built from 501dafaeba
This commit is contained in:
parent
63563ca665
commit
2c30a11e0a
12 changed files with 209 additions and 47 deletions
21
Servant-API-Header.html
Normal file
21
Servant-API-Header.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Servant.API.Header</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();setSynopsis("mini_Servant-API-Header.html");};
|
||||
//]]>
|
||||
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Servant-API-Header.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">servant-0.2: A family of combinators for defining webservices APIs and serving them</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Servant.API.Header</p></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Header">Header</a> sym a</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Header" class="def">Header</a> sym a <a href="src/Servant-API-Header.html#Header" class="link">Source</a></p><div class="doc"><p>Extract the given header's value as a value of type <code>a</code>.</p><p>Example:</p><pre>newtype Referer = Referer Text
|
||||
deriving (Eq, Show, FromText, ToText)
|
||||
|
||||
-- GET /view-my-referer
|
||||
type MyApi = "view-my-referer" :> Header "from" Referer :> Get Referer</pre></div><div class="subs instances"><p id="control.i:Header" class="caption collapser" onclick="toggleSection('i:Header')">Instances</p><div id="section.i:Header" class="show"><table><tr><td class="src">(<a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:KnownSymbol">KnownSymbol</a> sym, <a href="Servant-Common-Text.html#t:FromText">FromText</a> a, <a href="Servant-Server.html#t:HasServer">HasServer</a> sublayout) => <a href="Servant-Server.html#t:HasServer">HasServer</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-Header.html#t:Header">Header</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> * sym a) sublayout)</td><td class="doc"><p>If you use <code><a href="Servant-API-Header.html#t:Header">Header</a></code> in one of the endpoints for your API,
|
||||
this automatically requires your server-side handler to be a function
|
||||
that takes an argument of the type specified by <code><a href="Servant-API-Header.html#t:Header">Header</a></code>.
|
||||
This lets servant worry about extracting it from the request and turning
|
||||
it into a value of the type you specify.</p><p>All it asks is for a <code><a href="Servant-Common-Text.html#t:FromText">FromText</a></code> instance.</p><p>Example:</p><pre>newtype Referer = Referer Text
|
||||
deriving (Eq, Show, FromText, ToText)
|
||||
|
||||
-- GET /view-my-referer
|
||||
type MyApi = "view-my-referer" :> Header "Referer" Referer :> Get Referer
|
||||
|
||||
server :: Server MyApi
|
||||
server = viewReferer
|
||||
where viewReferer :: Referer -> EitherT (Int, String) IO referer
|
||||
viewReferer referer = return referer</pre></td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-Header.html#t:Header">Header</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> * sym a) sublayout) = <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Maybe.html#t:Maybe">Maybe</a> a -> <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.15.0</p></div></body></html>
|
|
@ -14,7 +14,20 @@ type MyApi = "hello" :> "world" :> Get World</pre></di
|
|||
server :: Server MyApi
|
||||
server = getBook
|
||||
where getBook :: Text -> EitherT (Int, String) IO Book
|
||||
getBook isbn = ...</pre></td></tr><tr><td class="src">(<a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:KnownSymbol">KnownSymbol</a> sym, <a href="Servant-Server.html#t:HasServer">HasServer</a> sublayout) => <a href="Servant-Server.html#t:HasServer">HasServer</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-QueryParam.html#t:QueryFlag">QueryFlag</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> sym) sublayout)</td><td class="doc"><p>If you use <code><code><a href="Servant-API-QueryParam.html#t:QueryFlag">QueryFlag</a></code> "published"</code> in one of the endpoints for your API,
|
||||
getBook isbn = ...</pre></td></tr><tr><td class="src">(<a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:KnownSymbol">KnownSymbol</a> sym, <a href="Servant-Common-Text.html#t:FromText">FromText</a> a, <a href="Servant-Server.html#t:HasServer">HasServer</a> sublayout) => <a href="Servant-Server.html#t:HasServer">HasServer</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-Header.html#t:Header">Header</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> * sym a) sublayout)</td><td class="doc"><p>If you use <code><a href="Servant-API-Header.html#t:Header">Header</a></code> in one of the endpoints for your API,
|
||||
this automatically requires your server-side handler to be a function
|
||||
that takes an argument of the type specified by <code><a href="Servant-API-Header.html#t:Header">Header</a></code>.
|
||||
This lets servant worry about extracting it from the request and turning
|
||||
it into a value of the type you specify.</p><p>All it asks is for a <code><a href="Servant-Common-Text.html#t:FromText">FromText</a></code> instance.</p><p>Example:</p><pre>newtype Referer = Referer Text
|
||||
deriving (Eq, Show, FromText, ToText)
|
||||
|
||||
-- GET /view-my-referer
|
||||
type MyApi = "view-my-referer" :> Header "Referer" Referer :> Get Referer
|
||||
|
||||
server :: Server MyApi
|
||||
server = viewReferer
|
||||
where viewReferer :: Referer -> EitherT (Int, String) IO referer
|
||||
viewReferer referer = return referer</pre></td></tr><tr><td class="src">(<a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:KnownSymbol">KnownSymbol</a> sym, <a href="Servant-Server.html#t:HasServer">HasServer</a> sublayout) => <a href="Servant-Server.html#t:HasServer">HasServer</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-QueryParam.html#t:QueryFlag">QueryFlag</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> sym) sublayout)</td><td class="doc"><p>If you use <code><code><a href="Servant-API-QueryParam.html#t:QueryFlag">QueryFlag</a></code> "published"</code> in one of the endpoints for your API,
|
||||
this automatically requires your server-side handler to be a function
|
||||
that takes an argument of type <code><a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#t:Bool">Bool</a></code>.</p><p>Example:</p><pre>type MyApi = "books" :> QueryFlag "published" :> Get [Book]
|
||||
|
||||
|
@ -53,4 +66,4 @@ server :: Server MyApi
|
|||
server = postBook
|
||||
where postBook :: Book -> EitherT (Int, String) IO Book
|
||||
postBook book = ...insert into your db...</pre></td></tr><tr><td class="src">(<a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:KnownSymbol">KnownSymbol</a> path, <a href="Servant-Server.html#t:HasServer">HasServer</a> sublayout) => <a href="Servant-Server.html#t:HasServer">HasServer</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> path sublayout)</td><td class="doc"><p>Make sure the incoming request starts with <code>"/path"</code>, strip it and
|
||||
pass the rest of the request path to <code>sublayout</code>.</p></td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-Capture.html#t:Capture">Capture</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> * capture a) sublayout) = a -> <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-QueryParam.html#t:QueryFlag">QueryFlag</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> sym) sublayout) = <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#t:Bool">Bool</a> -> <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-QueryParam.html#t:QueryParams">QueryParams</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> * sym a) sublayout) = [a] -> <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-QueryParam.html#t:QueryParam">QueryParam</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> * sym a) sublayout) = <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Maybe.html#t:Maybe">Maybe</a> a -> <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-ReqBody.html#t:ReqBody">ReqBody</a> * a) sublayout) = a -> <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> path sublayout) = <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.15.0</p></div></body></html>
|
||||
pass the rest of the request path to <code>sublayout</code>.</p></td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-Capture.html#t:Capture">Capture</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> * capture a) sublayout) = a -> <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-Header.html#t:Header">Header</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> * sym a) sublayout) = <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Maybe.html#t:Maybe">Maybe</a> a -> <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-QueryParam.html#t:QueryFlag">QueryFlag</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> sym) sublayout) = <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#t:Bool">Bool</a> -> <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-QueryParam.html#t:QueryParams">QueryParams</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> * sym a) sublayout) = [a] -> <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-QueryParam.html#t:QueryParam">QueryParam</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> * sym a) sublayout) = <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Maybe.html#t:Maybe">Maybe</a> a -> <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-ReqBody.html#t:ReqBody">ReqBody</a> * a) sublayout) = a -> <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr><tr><td class="src"><span class="keyword">type</span> <a href="Servant-Server.html#t:Server">Server</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> path sublayout) = <a href="Servant-Server.html#t:Server">Server</a> sublayout</td><td class="doc empty"> </td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.15.0</p></div></body></html>
|
File diff suppressed because one or more lines are too long
|
@ -74,7 +74,20 @@ server = listAllBooks :<|> postBook
|
|||
server :: Server MyApi
|
||||
server = getBook
|
||||
where getBook :: Text -> EitherT (Int, String) IO Book
|
||||
getBook isbn = ...</pre></td></tr><tr><td class="src">(<a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:KnownSymbol">KnownSymbol</a> sym, <a href="Servant-Server.html#t:HasServer">HasServer</a> sublayout) => <a href="Servant-Server.html#t:HasServer">HasServer</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-QueryParam.html#t:QueryFlag">QueryFlag</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> sym) sublayout)</td><td class="doc"><p>If you use <code><code><a href="Servant-API-QueryParam.html#t:QueryFlag">QueryFlag</a></code> "published"</code> in one of the endpoints for your API,
|
||||
getBook isbn = ...</pre></td></tr><tr><td class="src">(<a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:KnownSymbol">KnownSymbol</a> sym, <a href="Servant-Common-Text.html#t:FromText">FromText</a> a, <a href="Servant-Server.html#t:HasServer">HasServer</a> sublayout) => <a href="Servant-Server.html#t:HasServer">HasServer</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-Header.html#t:Header">Header</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> * sym a) sublayout)</td><td class="doc"><p>If you use <code><a href="Servant-API-Header.html#t:Header">Header</a></code> in one of the endpoints for your API,
|
||||
this automatically requires your server-side handler to be a function
|
||||
that takes an argument of the type specified by <code><a href="Servant-API-Header.html#t:Header">Header</a></code>.
|
||||
This lets servant worry about extracting it from the request and turning
|
||||
it into a value of the type you specify.</p><p>All it asks is for a <code><a href="Servant-Common-Text.html#t:FromText">FromText</a></code> instance.</p><p>Example:</p><pre>newtype Referer = Referer Text
|
||||
deriving (Eq, Show, FromText, ToText)
|
||||
|
||||
-- GET /view-my-referer
|
||||
type MyApi = "view-my-referer" :> Header "Referer" Referer :> Get Referer
|
||||
|
||||
server :: Server MyApi
|
||||
server = viewReferer
|
||||
where viewReferer :: Referer -> EitherT (Int, String) IO referer
|
||||
viewReferer referer = return referer</pre></td></tr><tr><td class="src">(<a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:KnownSymbol">KnownSymbol</a> sym, <a href="Servant-Server.html#t:HasServer">HasServer</a> sublayout) => <a href="Servant-Server.html#t:HasServer">HasServer</a> (<a href="Servant-API-Sub.html#t::-62-">(:>)</a> * (<a href="Servant-API-QueryParam.html#t:QueryFlag">QueryFlag</a> <a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-TypeLits.html#t:Symbol">Symbol</a> sym) sublayout)</td><td class="doc"><p>If you use <code><code><a href="Servant-API-QueryParam.html#t:QueryFlag">QueryFlag</a></code> "published"</code> in one of the endpoints for your API,
|
||||
this automatically requires your server-side handler to be a function
|
||||
that takes an argument of type <code><a href="https://hackage.haskell.org/package/base-4.7.0.1/docs/Data-Bool.html#t:Bool">Bool</a></code>.</p><p>Example:</p><pre>type MyApi = "books" :> QueryFlag "published" :> Get [Book]
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>servant-0.2: A family of combinators for defining webservices APIs and serving them</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();};
|
||||
//]]>
|
||||
</script></head><body id="mini"><div id="module-list"><p class="caption">Modules</p><ul><li class="module"><a href="Servant.html" target="main">Servant</a></li><li class="module"><a href="Servant-API.html" target="main">Servant.API</a></li><li class="module"><a href="Servant-API-Alternative.html" target="main">Servant.API.Alternative</a></li><li class="module"><a href="Servant-API-Capture.html" target="main">Servant.API.Capture</a></li><li class="module"><a href="Servant-API-Delete.html" target="main">Servant.API.Delete</a></li><li class="module"><a href="Servant-API-Get.html" target="main">Servant.API.Get</a></li><li class="module"><a href="Servant-API-Post.html" target="main">Servant.API.Post</a></li><li class="module"><a href="Servant-API-Put.html" target="main">Servant.API.Put</a></li><li class="module"><a href="Servant-API-QueryParam.html" target="main">Servant.API.QueryParam</a></li><li class="module"><a href="Servant-API-Raw.html" target="main">Servant.API.Raw</a></li><li class="module"><a href="Servant-API-ReqBody.html" target="main">Servant.API.ReqBody</a></li><li class="module"><a href="Servant-API-Sub.html" target="main">Servant.API.Sub</a></li><li class="module"><a href="Servant-Common-Text.html" target="main">Servant.Common.Text</a></li><li class="module"><a href="Servant-QQ.html" target="main">Servant.QQ</a></li><li class="module"><a href="Servant-Server.html" target="main">Servant.Server</a></li><li class="module"><a href="Servant-Utils-Links.html" target="main">Servant.Utils.Links</a></li><li class="module"><a href="Servant-Utils-StaticFiles.html" target="main">Servant.Utils.StaticFiles</a></li></ul></div></body></html>
|
||||
</script></head><body id="mini"><div id="module-list"><p class="caption">Modules</p><ul><li class="module"><a href="Servant.html" target="main">Servant</a></li><li class="module"><a href="Servant-API.html" target="main">Servant.API</a></li><li class="module"><a href="Servant-API-Alternative.html" target="main">Servant.API.Alternative</a></li><li class="module"><a href="Servant-API-Capture.html" target="main">Servant.API.Capture</a></li><li class="module"><a href="Servant-API-Delete.html" target="main">Servant.API.Delete</a></li><li class="module"><a href="Servant-API-Get.html" target="main">Servant.API.Get</a></li><li class="module"><a href="Servant-API-Header.html" target="main">Servant.API.Header</a></li><li class="module"><a href="Servant-API-Post.html" target="main">Servant.API.Post</a></li><li class="module"><a href="Servant-API-Put.html" target="main">Servant.API.Put</a></li><li class="module"><a href="Servant-API-QueryParam.html" target="main">Servant.API.QueryParam</a></li><li class="module"><a href="Servant-API-Raw.html" target="main">Servant.API.Raw</a></li><li class="module"><a href="Servant-API-ReqBody.html" target="main">Servant.API.ReqBody</a></li><li class="module"><a href="Servant-API-Sub.html" target="main">Servant.API.Sub</a></li><li class="module"><a href="Servant-Common-Text.html" target="main">Servant.Common.Text</a></li><li class="module"><a href="Servant-QQ.html" target="main">Servant.QQ</a></li><li class="module"><a href="Servant-Server.html" target="main">Servant.Server</a></li><li class="module"><a href="Servant-Utils-Links.html" target="main">Servant.Utils.Links</a></li><li class="module"><a href="Servant-Utils-StaticFiles.html" target="main">Servant.Utils.StaticFiles</a></li></ul></div></body></html>
|
|
@ -1,4 +1,4 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>servant-0.2: A family of combinators for defining webservices APIs and serving them</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();};
|
||||
//]]>
|
||||
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">servant-0.2: A family of combinators for defining webservices APIs and serving them</p></div><div id="content"><div id="description"><h1>servant-0.2: A family of combinators for defining webservices APIs and serving them</h1><div class="doc empty"> </div></div><div id="module-list"><p class="caption">Modules</p><ul><li><span class="module"><span id="control.n.1" class="collapser" onclick="toggleSection('n.1')"> </span><a href="Servant.html">Servant</a></span><ul id="section.n.1" class="show"><li><span class="module"><span id="control.n.1.1" class="collapser" onclick="toggleSection('n.1.1')"> </span><a href="Servant-API.html">Servant.API</a></span><ul id="section.n.1.1" class="show"><li><span class="module"><a href="Servant-API-Alternative.html">Servant.API.Alternative</a></span></li><li><span class="module"><a href="Servant-API-Capture.html">Servant.API.Capture</a></span></li><li><span class="module"><a href="Servant-API-Delete.html">Servant.API.Delete</a></span></li><li><span class="module"><a href="Servant-API-Get.html">Servant.API.Get</a></span></li><li><span class="module"><a href="Servant-API-Post.html">Servant.API.Post</a></span></li><li><span class="module"><a href="Servant-API-Put.html">Servant.API.Put</a></span></li><li><span class="module"><a href="Servant-API-QueryParam.html">Servant.API.QueryParam</a></span></li><li><span class="module"><a href="Servant-API-Raw.html">Servant.API.Raw</a></span></li><li><span class="module"><a href="Servant-API-ReqBody.html">Servant.API.ReqBody</a></span></li><li><span class="module"><a href="Servant-API-Sub.html">Servant.API.Sub</a></span></li></ul></li><li><span id="control.n.1.2" class="module collapser" onclick="toggleSection('n.1.2')">Common</span><ul id="section.n.1.2" class="show"><li><span class="module"><a href="Servant-Common-Text.html">Servant.Common.Text</a></span></li></ul></li><li><span class="module"><a href="Servant-QQ.html">Servant.QQ</a></span></li><li><span class="module"><a href="Servant-Server.html">Servant.Server</a></span></li><li><span id="control.n.1.5" class="module collapser" onclick="toggleSection('n.1.5')">Utils</span><ul id="section.n.1.5" class="show"><li><span class="module"><a href="Servant-Utils-Links.html">Servant.Utils.Links</a></span></li><li><span class="module"><a href="Servant-Utils-StaticFiles.html">Servant.Utils.StaticFiles</a></span></li></ul></li></ul></li></ul></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.15.0</p></div></body></html>
|
||||
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">servant-0.2: A family of combinators for defining webservices APIs and serving them</p></div><div id="content"><div id="description"><h1>servant-0.2: A family of combinators for defining webservices APIs and serving them</h1><div class="doc empty"> </div></div><div id="module-list"><p class="caption">Modules</p><ul><li><span class="module"><span id="control.n.1" class="collapser" onclick="toggleSection('n.1')"> </span><a href="Servant.html">Servant</a></span><ul id="section.n.1" class="show"><li><span class="module"><span id="control.n.1.1" class="collapser" onclick="toggleSection('n.1.1')"> </span><a href="Servant-API.html">Servant.API</a></span><ul id="section.n.1.1" class="show"><li><span class="module"><a href="Servant-API-Alternative.html">Servant.API.Alternative</a></span></li><li><span class="module"><a href="Servant-API-Capture.html">Servant.API.Capture</a></span></li><li><span class="module"><a href="Servant-API-Delete.html">Servant.API.Delete</a></span></li><li><span class="module"><a href="Servant-API-Get.html">Servant.API.Get</a></span></li><li><span class="module"><a href="Servant-API-Header.html">Servant.API.Header</a></span></li><li><span class="module"><a href="Servant-API-Post.html">Servant.API.Post</a></span></li><li><span class="module"><a href="Servant-API-Put.html">Servant.API.Put</a></span></li><li><span class="module"><a href="Servant-API-QueryParam.html">Servant.API.QueryParam</a></span></li><li><span class="module"><a href="Servant-API-Raw.html">Servant.API.Raw</a></span></li><li><span class="module"><a href="Servant-API-ReqBody.html">Servant.API.ReqBody</a></span></li><li><span class="module"><a href="Servant-API-Sub.html">Servant.API.Sub</a></span></li></ul></li><li><span id="control.n.1.2" class="module collapser" onclick="toggleSection('n.1.2')">Common</span><ul id="section.n.1.2" class="show"><li><span class="module"><a href="Servant-Common-Text.html">Servant.Common.Text</a></span></li></ul></li><li><span class="module"><a href="Servant-QQ.html">Servant.QQ</a></span></li><li><span class="module"><a href="Servant-Server.html">Servant.Server</a></span></li><li><span id="control.n.1.5" class="module collapser" onclick="toggleSection('n.1.5')">Utils</span><ul id="section.n.1.5" class="show"><li><span class="module"><a href="Servant-Utils-Links.html">Servant.Utils.Links</a></span></li><li><span class="module"><a href="Servant-Utils-StaticFiles.html">Servant.Utils.StaticFiles</a></span></li></ul></li></ul></li></ul></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.15.0</p></div></body></html>
|
4
mini_Servant-API-Header.html
Normal file
4
mini_Servant-API-Header.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Servant.API.Header</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
||||
window.onload = function () {pageLoad();};
|
||||
//]]>
|
||||
</script></head><body id="mini"><div id="module-header"><p class="caption">Servant.API.Header</p></div><div id="interface"><div class="top"><p class="src"><span class="keyword">data</span> <a href="Servant-API-Header.html#t:Header" target="main">Header</a> sym a</p></div></div></body></html>
|
BIN
servant.haddock
BIN
servant.haddock
Binary file not shown.
39
servant.txt
39
servant.txt
|
@ -178,6 +178,45 @@ module Servant.API.Capture
|
|||
data Capture sym a
|
||||
instance (KnownSymbol capture, FromText a, HasServer sublayout) => HasServer (Capture capture a :> sublayout)
|
||||
|
||||
module Servant.API.Header
|
||||
|
||||
-- | Extract the given header's value as a value of type <tt>a</tt>.
|
||||
--
|
||||
-- Example:
|
||||
--
|
||||
-- <pre>
|
||||
-- newtype Referer = Referer Text
|
||||
-- deriving (Eq, Show, FromText, ToText)
|
||||
--
|
||||
-- -- GET /view-my-referer
|
||||
-- type MyApi = "view-my-referer" :> Header "from" Referer :> Get Referer
|
||||
-- </pre>
|
||||
data Header sym a
|
||||
|
||||
-- | If you use <a>Header</a> in one of the endpoints for your API, this
|
||||
-- automatically requires your server-side handler to be a function that
|
||||
-- takes an argument of the type specified by <a>Header</a>. This lets
|
||||
-- servant worry about extracting it from the request and turning it into
|
||||
-- a value of the type you specify.
|
||||
--
|
||||
-- All it asks is for a <a>FromText</a> instance.
|
||||
--
|
||||
-- Example:
|
||||
--
|
||||
-- <pre>
|
||||
-- newtype Referer = Referer Text
|
||||
-- deriving (Eq, Show, FromText, ToText)
|
||||
--
|
||||
-- -- GET /view-my-referer
|
||||
-- type MyApi = "view-my-referer" :> Header "Referer" Referer :> Get Referer
|
||||
--
|
||||
-- server :: Server MyApi
|
||||
-- server = viewReferer
|
||||
-- where viewReferer :: Referer -> EitherT (Int, String) IO referer
|
||||
-- viewReferer referer = return referer
|
||||
-- </pre>
|
||||
instance (KnownSymbol sym, FromText a, HasServer sublayout) => HasServer (Header sym a :> sublayout)
|
||||
|
||||
module Servant.API.QueryParam
|
||||
|
||||
-- | Lookup the value associated to the <tt>sym</tt> query string parameter
|
||||
|
|
69
src/Servant-API-Header.html
Normal file
69
src/Servant-API-Header.html
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
|
||||
<title>src/Servant/API/Header.hs</title>
|
||||
<link type='text/css' rel='stylesheet' href='hscolour.css' />
|
||||
</head>
|
||||
<body>
|
||||
<pre><a name="line-1"></a><span class='hs-comment'>{-# LANGUAGE PolyKinds #-}</span>
|
||||
<a name="line-2"></a><span class='hs-comment'>{-# LANGUAGE TypeFamilies #-}</span>
|
||||
<a name="line-3"></a><span class='hs-comment'>{-# LANGUAGE TypeOperators #-}</span>
|
||||
<a name="line-4"></a><span class='hs-comment'>{-# LANGUAGE FlexibleInstances #-}</span>
|
||||
<a name="line-5"></a><span class='hs-comment'>{-# LANGUAGE ScopedTypeVariables #-}</span>
|
||||
<a name="line-6"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Header</span> <span class='hs-keyword'>where</span>
|
||||
<a name="line-7"></a>
|
||||
<a name="line-8"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Proxy</span>
|
||||
<a name="line-9"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>String</span>
|
||||
<a name="line-10"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span><span class='hs-varop'>.</span><span class='hs-conid'>Encoding</span> <span class='hs-layout'>(</span><span class='hs-varid'>decodeUtf8</span><span class='hs-layout'>)</span>
|
||||
<a name="line-11"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>GHC</span><span class='hs-varop'>.</span><span class='hs-conid'>TypeLits</span>
|
||||
<a name="line-12"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Network</span><span class='hs-varop'>.</span><span class='hs-conid'>Wai</span>
|
||||
<a name="line-13"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Sub</span>
|
||||
<a name="line-14"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>Common</span><span class='hs-varop'>.</span><span class='hs-conid'>Text</span>
|
||||
<a name="line-15"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>Server</span>
|
||||
<a name="line-16"></a>
|
||||
<a name="line-17"></a><a name="HasServer"></a><span class='hs-comment'>-- | Extract the given header's value as a value of type @a@.</span>
|
||||
<a name="line-18"></a><a name="HasServer"></a><span class='hs-comment'>--</span>
|
||||
<a name="line-19"></a><a name="HasServer"></a><span class='hs-comment'>-- Example:</span>
|
||||
<a name="line-20"></a><a name="HasServer"></a><span class='hs-comment'>--</span>
|
||||
<a name="line-21"></a><a name="HasServer"></a><span class='hs-comment'>-- > newtype Referer = Referer Text</span>
|
||||
<a name="line-22"></a><a name="HasServer"></a><span class='hs-comment'>-- > deriving (Eq, Show, FromText, ToText)</span>
|
||||
<a name="line-23"></a><a name="HasServer"></a><span class='hs-comment'>-- ></span>
|
||||
<a name="line-24"></a><a name="HasServer"></a><span class='hs-comment'>-- > -- GET /view-my-referer</span>
|
||||
<a name="line-25"></a><a name="HasServer"></a><span class='hs-comment'>-- > type MyApi = "view-my-referer" :> Header "from" Referer :> Get Referer</span>
|
||||
<a name="line-26"></a><a name="HasServer"></a><span class='hs-keyword'>data</span> <span class='hs-conid'>Header</span> <span class='hs-varid'>sym</span> <span class='hs-varid'>a</span>
|
||||
<a name="line-27"></a>
|
||||
<a name="line-28"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- | If you use 'Header' in one of the endpoints for your API,</span>
|
||||
<a name="line-29"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- this automatically requires your server-side handler to be a function</span>
|
||||
<a name="line-30"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- that takes an argument of the type specified by 'Header'.</span>
|
||||
<a name="line-31"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- This lets servant worry about extracting it from the request and turning</span>
|
||||
<a name="line-32"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- it into a value of the type you specify.</span>
|
||||
<a name="line-33"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>--</span>
|
||||
<a name="line-34"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- All it asks is for a 'FromText' instance.</span>
|
||||
<a name="line-35"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>--</span>
|
||||
<a name="line-36"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- Example:</span>
|
||||
<a name="line-37"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>--</span>
|
||||
<a name="line-38"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- > newtype Referer = Referer Text</span>
|
||||
<a name="line-39"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- > deriving (Eq, Show, FromText, ToText)</span>
|
||||
<a name="line-40"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- ></span>
|
||||
<a name="line-41"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- > -- GET /view-my-referer</span>
|
||||
<a name="line-42"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- > type MyApi = "view-my-referer" :> Header "Referer" Referer :> Get Referer</span>
|
||||
<a name="line-43"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- ></span>
|
||||
<a name="line-44"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- > server :: Server MyApi</span>
|
||||
<a name="line-45"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- > server = viewReferer</span>
|
||||
<a name="line-46"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- > where viewReferer :: Referer -> EitherT (Int, String) IO referer</span>
|
||||
<a name="line-47"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-comment'>-- > viewReferer referer = return referer</span>
|
||||
<a name="line-48"></a><a name="instance%20HasServer%20(Header%20sym%20a%20:%3e%20sublayout)"></a><span class='hs-keyword'>instance</span> <span class='hs-layout'>(</span><span class='hs-conid'>KnownSymbol</span> <span class='hs-varid'>sym</span><span class='hs-layout'>,</span> <span class='hs-conid'>FromText</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>HasServer</span> <span class='hs-varid'>sublayout</span><span class='hs-layout'>)</span>
|
||||
<a name="line-49"></a> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>HasServer</span> <span class='hs-layout'>(</span><span class='hs-conid'>Header</span> <span class='hs-varid'>sym</span> <span class='hs-varid'>a</span> <span class='hs-conop'>:></span> <span class='hs-varid'>sublayout</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
|
||||
<a name="line-50"></a>
|
||||
<a name="line-51"></a> <span class='hs-keyword'>type</span> <span class='hs-conid'>Server</span> <span class='hs-layout'>(</span><span class='hs-conid'>Header</span> <span class='hs-varid'>sym</span> <span class='hs-varid'>a</span> <span class='hs-conop'>:></span> <span class='hs-varid'>sublayout</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span>
|
||||
<a name="line-52"></a> <span class='hs-conid'>Maybe</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Server</span> <span class='hs-varid'>sublayout</span>
|
||||
<a name="line-53"></a>
|
||||
<a name="line-54"></a> <span class='hs-varid'>route</span> <span class='hs-conid'>Proxy</span> <span class='hs-varid'>subserver</span> <span class='hs-varid'>request</span> <span class='hs-varid'>respond</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
|
||||
<a name="line-55"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>mheader</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fromText</span> <span class='hs-varop'>.</span> <span class='hs-varid'>decodeUtf8</span> <span class='hs-varop'>=<<</span> <span class='hs-varid'>lookup</span> <span class='hs-varid'>str</span> <span class='hs-layout'>(</span><span class='hs-varid'>requestHeaders</span> <span class='hs-varid'>request</span><span class='hs-layout'>)</span>
|
||||
<a name="line-56"></a> <span class='hs-varid'>route</span> <span class='hs-layout'>(</span><span class='hs-conid'>Proxy</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Proxy</span> <span class='hs-varid'>sublayout</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>subserver</span> <span class='hs-varid'>mheader</span><span class='hs-layout'>)</span> <span class='hs-varid'>request</span> <span class='hs-varid'>respond</span>
|
||||
<a name="line-57"></a>
|
||||
<a name="line-58"></a> <span class='hs-keyword'>where</span> <span class='hs-varid'>str</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fromString</span> <span class='hs-varop'>$</span> <span class='hs-varid'>symbolVal</span> <span class='hs-layout'>(</span><span class='hs-conid'>Proxy</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Proxy</span> <span class='hs-varid'>sym</span><span class='hs-layout'>)</span>
|
||||
</pre></body>
|
||||
</html>
|
|
@ -18,45 +18,48 @@
|
|||
<a name="line-9"></a> <span class='hs-comment'>-- * Accessing information from the request</span>
|
||||
<a name="line-10"></a> <span class='hs-comment'>-- | Capturing parts of the url path as parsed values: @'Capture'@</span>
|
||||
<a name="line-11"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Capture</span><span class='hs-layout'>,</span>
|
||||
<a name="line-12"></a> <span class='hs-comment'>-- | Retrieving parameters from the query string of the 'URI': @'QueryParam'@</span>
|
||||
<a name="line-13"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>QueryParam</span><span class='hs-layout'>,</span>
|
||||
<a name="line-14"></a> <span class='hs-comment'>-- | Accessing the request body as a JSON-encoded type: @'ReqBody'@</span>
|
||||
<a name="line-15"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>ReqBody</span><span class='hs-layout'>,</span>
|
||||
<a name="line-16"></a>
|
||||
<a name="line-17"></a> <span class='hs-comment'>-- * Actual endpoints, distinguished by HTTP method</span>
|
||||
<a name="line-18"></a> <span class='hs-comment'>-- | GET requests</span>
|
||||
<a name="line-19"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Get</span><span class='hs-layout'>,</span>
|
||||
<a name="line-20"></a> <span class='hs-comment'>-- | POST requests</span>
|
||||
<a name="line-21"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Post</span><span class='hs-layout'>,</span>
|
||||
<a name="line-22"></a> <span class='hs-comment'>-- | DELETE requests</span>
|
||||
<a name="line-23"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Delete</span><span class='hs-layout'>,</span>
|
||||
<a name="line-24"></a> <span class='hs-comment'>-- | PUT requests</span>
|
||||
<a name="line-25"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Put</span><span class='hs-layout'>,</span>
|
||||
<a name="line-26"></a>
|
||||
<a name="line-27"></a> <span class='hs-comment'>-- * Untyped endpoints</span>
|
||||
<a name="line-28"></a> <span class='hs-comment'>-- | Plugging in a wai 'Network.Wai.Application', serving directories</span>
|
||||
<a name="line-29"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Raw</span><span class='hs-layout'>,</span>
|
||||
<a name="line-30"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span><span class='hs-varop'>.</span><span class='hs-conid'>StaticFiles</span><span class='hs-layout'>,</span>
|
||||
<a name="line-31"></a>
|
||||
<a name="line-32"></a> <span class='hs-comment'>-- * Utilities</span>
|
||||
<a name="line-33"></a> <span class='hs-comment'>-- | QuasiQuotes for endpoints</span>
|
||||
<a name="line-34"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>QQ</span><span class='hs-layout'>,</span>
|
||||
<a name="line-35"></a> <span class='hs-comment'>-- | Type-safe internal URLs</span>
|
||||
<a name="line-36"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span><span class='hs-varop'>.</span><span class='hs-conid'>Links</span><span class='hs-layout'>,</span>
|
||||
<a name="line-37"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
|
||||
<a name="line-38"></a>
|
||||
<a name="line-39"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Alternative</span>
|
||||
<a name="line-40"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Capture</span>
|
||||
<a name="line-41"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Delete</span>
|
||||
<a name="line-42"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Get</span>
|
||||
<a name="line-43"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Post</span>
|
||||
<a name="line-44"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Put</span>
|
||||
<a name="line-45"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>QueryParam</span>
|
||||
<a name="line-46"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Raw</span>
|
||||
<a name="line-47"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>ReqBody</span>
|
||||
<a name="line-48"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Sub</span>
|
||||
<a name="line-49"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>QQ</span> <span class='hs-layout'>(</span><span class='hs-varid'>sitemap</span><span class='hs-layout'>)</span>
|
||||
<a name="line-50"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span><span class='hs-varop'>.</span><span class='hs-conid'>Links</span> <span class='hs-layout'>(</span><span class='hs-varid'>mkLink</span><span class='hs-layout'>)</span>
|
||||
<a name="line-51"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span><span class='hs-varop'>.</span><span class='hs-conid'>StaticFiles</span>
|
||||
<a name="line-12"></a> <span class='hs-comment'>-- | Retrieving specific headers from the request</span>
|
||||
<a name="line-13"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Header</span><span class='hs-layout'>,</span>
|
||||
<a name="line-14"></a> <span class='hs-comment'>-- | Retrieving parameters from the query string of the 'URI': @'QueryParam'@</span>
|
||||
<a name="line-15"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>QueryParam</span><span class='hs-layout'>,</span>
|
||||
<a name="line-16"></a> <span class='hs-comment'>-- | Accessing the request body as a JSON-encoded type: @'ReqBody'@</span>
|
||||
<a name="line-17"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>ReqBody</span><span class='hs-layout'>,</span>
|
||||
<a name="line-18"></a>
|
||||
<a name="line-19"></a> <span class='hs-comment'>-- * Actual endpoints, distinguished by HTTP method</span>
|
||||
<a name="line-20"></a> <span class='hs-comment'>-- | GET requests</span>
|
||||
<a name="line-21"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Get</span><span class='hs-layout'>,</span>
|
||||
<a name="line-22"></a> <span class='hs-comment'>-- | POST requests</span>
|
||||
<a name="line-23"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Post</span><span class='hs-layout'>,</span>
|
||||
<a name="line-24"></a> <span class='hs-comment'>-- | DELETE requests</span>
|
||||
<a name="line-25"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Delete</span><span class='hs-layout'>,</span>
|
||||
<a name="line-26"></a> <span class='hs-comment'>-- | PUT requests</span>
|
||||
<a name="line-27"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Put</span><span class='hs-layout'>,</span>
|
||||
<a name="line-28"></a>
|
||||
<a name="line-29"></a> <span class='hs-comment'>-- * Untyped endpoints</span>
|
||||
<a name="line-30"></a> <span class='hs-comment'>-- | Plugging in a wai 'Network.Wai.Application', serving directories</span>
|
||||
<a name="line-31"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Raw</span><span class='hs-layout'>,</span>
|
||||
<a name="line-32"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span><span class='hs-varop'>.</span><span class='hs-conid'>StaticFiles</span><span class='hs-layout'>,</span>
|
||||
<a name="line-33"></a>
|
||||
<a name="line-34"></a> <span class='hs-comment'>-- * Utilities</span>
|
||||
<a name="line-35"></a> <span class='hs-comment'>-- | QuasiQuotes for endpoints</span>
|
||||
<a name="line-36"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>QQ</span><span class='hs-layout'>,</span>
|
||||
<a name="line-37"></a> <span class='hs-comment'>-- | Type-safe internal URLs</span>
|
||||
<a name="line-38"></a> <span class='hs-keyword'>module</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span><span class='hs-varop'>.</span><span class='hs-conid'>Links</span><span class='hs-layout'>,</span>
|
||||
<a name="line-39"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
|
||||
<a name="line-40"></a>
|
||||
<a name="line-41"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Alternative</span>
|
||||
<a name="line-42"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Capture</span>
|
||||
<a name="line-43"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Delete</span>
|
||||
<a name="line-44"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Get</span>
|
||||
<a name="line-45"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Header</span>
|
||||
<a name="line-46"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Post</span>
|
||||
<a name="line-47"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Put</span>
|
||||
<a name="line-48"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>QueryParam</span>
|
||||
<a name="line-49"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Raw</span>
|
||||
<a name="line-50"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>ReqBody</span>
|
||||
<a name="line-51"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>API</span><span class='hs-varop'>.</span><span class='hs-conid'>Sub</span>
|
||||
<a name="line-52"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>QQ</span> <span class='hs-layout'>(</span><span class='hs-varid'>sitemap</span><span class='hs-layout'>)</span>
|
||||
<a name="line-53"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span><span class='hs-varop'>.</span><span class='hs-conid'>Links</span> <span class='hs-layout'>(</span><span class='hs-varid'>mkLink</span><span class='hs-layout'>)</span>
|
||||
<a name="line-54"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Servant</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span><span class='hs-varop'>.</span><span class='hs-conid'>StaticFiles</span>
|
||||
</pre></body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue