mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-08 04:05:35 -05:00
2 lines
No EOL
2.4 KiB
HTML
2 lines
No EOL
2.4 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Middleware (tiny_httpd.Tiny_httpd_server.Middleware)</title><link rel="stylesheet" href="../../../_odoc_support/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../_odoc_support/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – <a href="../../index.html">tiny_httpd</a> » <a href="../index.html">Tiny_httpd_server</a> » Middleware</nav><header class="odoc-preamble"><h1>Module <code><span>Tiny_httpd_server.Middleware</span></code></h1></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-handler"><a href="#type-handler" class="anchor"></a><code><span><span class="keyword">type</span> handler</span><span> = <span><span><a href="../index.html#type-byte_stream">byte_stream</a> <a href="../Request/index.html#type-t">Request.t</a></span> <span class="arrow">-></span></span> <span>resp:<span>(<span><a href="../Response/index.html#type-t">Response.t</a> <span class="arrow">-></span></span> unit)</span> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Handlers are functions returning a response to a request. The response can be delayed, hence the use of a continuation as the <code>resp</code> parameter.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span><span> = <span><a href="#type-handler">handler</a> <span class="arrow">-></span></span> <a href="#type-handler">handler</a></span></code></div><div class="spec-doc"><p>A middleware is a handler transformation.</p><p>It takes the existing handler <code>h</code>, and returns a new one which, given a query, modify it or log it before passing it to <code>h</code>, or fail. It can also log or modify or drop the response.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-nil"><a href="#val-nil" class="anchor"></a><code><span><span class="keyword">val</span> nil : <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Trivial middleware that does nothing.</p></div></div></div></body></html> |