Skip to content

Commit

Permalink
Docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
trikko committed Jul 13, 2024
1 parent 1d42e51 commit cc64c42
Show file tree
Hide file tree
Showing 10 changed files with 332 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/file_hashes.json

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions docs/serverino/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ <h2>Enums</h2>
</code>
</td>
<td>UDA. Functions with @endpoint attached are called when a request is received
</td>
</tr>
<tr>
<td>
<code>
<a id="Fallthrough" class="public" href="../serverino/config/Fallthrough.html">Fallthrough</a>
</code>
</td>
<td>Used as optional return type for functions with <code class="lang-d"><span class="pun">@<a href="../serverino/config/endpoint.html"></span><span class="pln">endpoint</span></a></code>` UDA attached.
It is used to override the default behavior of serverino: if an endpoint returns Fallthrough.Yes, the next endpoint is called even if the current one has written to the output.
</td>
</tr>
<tr>
Expand Down Expand Up @@ -156,6 +166,15 @@ <h2>Enums</h2>
</code>
</td>
<td>UDA. Functions with @onWebSocketUpgrade attached are called when a websocket upgrade is requested
</td>
</tr>
<tr>
<td>
<code>
<a id="onWorkerException" class="public" href="../serverino/config/onWorkerException.html">onWorkerException</a>
</code>
</td>
<td>UDA. Functions with @onWorkerException attached are called when worker throws an exception
</td>
</tr>
<tr>
Expand Down
107 changes: 107 additions & 0 deletions docs/serverino/config/Fallthrough.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"/>
<title>Enum Fallthrough</title>
<link rel="stylesheet" href="../../css/style.min.css"/>
<script type="text/javascript" src="../../js/script.min.js"></script>
</head>
<body onload="setupDdox();">
<header></header>
<nav id="main-nav">
<div>
<noscript>
<p style="color: red">The search functionality needs JavaScript enabled</p>
</noscript>
<div id="symbolSearchPane" style="display: none">
<form action="#" method="GET">
<input id="symbolSearch" type="text" name="q" placeholder="Search for symbols" autocomplete="off" onchange="performSymbolSearch(24);" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();" autofocus/>
</form>
<ul id="symbolSearchResults" class="symbolList" style="display: none"></ul><script type="application/javascript" src="../../symbols.js"></script><script type="application/javascript">var symbolSearchRootDir = "../../";
document.getElementById('symbolSearchPane').style.display = 'block';</script>
</div>
<ul class="tree-view">
<li class="tree-view ">
<div class="package ">
<a href="../../serverino.html">serverino</a>
</div>
<ul class="tree-view">
<li>
<div class="module selected">
<a href="../../serverino/config.html">config</a>
</div>
</li>
<li>
<div class="module ">
<a href="../../serverino/interfaces.html">interfaces</a>
</div>
</li>
</ul>
</li>
</ul>
</div>
<p id="main-nav-footer">
Built with
<a href="https://github.com/MartinNowak/scod">scod</a>
</p>
</nav>
<div id="main-contents">
<div>
<h1>Enum Fallthrough</h1><p>Used as optional return type for functions with <code class="lang-d"><span class="pun">@<a href="../../serverino/config/endpoint.html"></span><span class="pln">endpoint</span></a></code>` UDA attached.
It is used to override the default behavior of serverino: if an endpoint returns Fallthrough.Yes, the next endpoint is called even if the current one has written to the output.
</p>
<div class="prototype">
<code class="lang-d">
<div class="single-prototype">
<span class="kwd">enum</span> <span class="typ">Fallthrough</span>
<span class="pun">:</span> <span class="typ">bool</span> <span class="pun">{ ... }</span>
</div>
</code>
</div>
<section><pre class="code"><code class="lang-d"><span class="com">// Doing a request to the server will return "Hello world!"

// Will continue with the next function
</span><span class="pun">@<a href="../../serverino/config/endpoint.html"></span><span class="pln">endpoint</span></a><span class="pln"> </span><span class="pun">@<a href="../../serverino/config/priority.html"></span><span class="pln">priority</span></a><span class="pun">(</span><span class="lit">3</span><span class="pun">) </span><span class="kwd">auto </span><span class="pln">test_1</span><span class="pun">(</span><span class="typ">Request </span><span class="pln">r</span><span class="pun">, </span><span class="typ">Output </span><span class="pln">o</span><span class="pun">) { </span><span class="pln">output </span><span class="pun">~= </span><span class="str">"Hello"</span><span class="pun">; </span><span class="kwd">return <a href="../../serverino/config/Fallthrough.html#Yes"></span><span class="typ">Fallthrough<wbr/></span><span class="pun">.</span><span class="typ">Yes</span></a><span class="pun">; }

</span><span class="com">// This blocks the chain (default behavior when output is written)
</span><span class="pun">@<a href="../../serverino/config/endpoint.html"></span><span class="pln">endpoint</span></a><span class="pln"> </span><span class="pun">@<a href="../../serverino/config/priority.html"></span><span class="pln">priority</span></a><span class="pun">(</span><span class="lit">2</span><span class="pun">) </span><span class="kwd">auto </span><span class="pln">test_2</span><span class="pun">(</span><span class="typ">Request </span><span class="pln">r</span><span class="pun">, </span><span class="typ">Output </span><span class="pln">o</span><span class="pun">) { </span><span class="pln">output </span><span class="pun">~= </span><span class="str">" world!"</span><span class="pun">; }

</span><span class="com">// Never executed (blocked by test_2)
</span><span class="pun">@<a href="../../serverino/config/endpoint.html"></span><span class="pln">endpoint</span></a><span class="pln"> </span><span class="pun">@<a href="../../serverino/config/priority.html"></span><span class="pln">priority</span></a><span class="pun">(</span><span class="lit">1</span><span class="pun">) </span><span class="kwd">auto </span><span class="pln">test_3</span><span class="pun">(</span><span class="typ">Request </span><span class="pln">r</span><span class="pun">, </span><span class="typ">Output </span><span class="pln">o</span><span class="pun">) { </span><span class="pln">output </span><span class="pun">~= </span><span class="str">"Not executed!"</span><span class="pun">; }</span></code></pre>
</section>

<section><h2>Enum members</h2>
<table>
<col class="caption"/>
<tr>
<th>Name</th><th>Description</th>
</tr>
<tr>
<td id="No">
<code>No</code>
</td>
<td>Stop the chain
</td>
</tr>
<tr>
<td id="Yes">
<code>Yes</code>
</td>
<td>Continue with the next function
</td>
</tr>
</table>
</section>

</div>
<footer>
<div id="license-info">



</div>
</footer>
</div>
</body>
</html>
88 changes: 88 additions & 0 deletions docs/serverino/config/onWorkerException.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"/>
<title>Enum onWorkerException</title>
<link rel="stylesheet" href="../../css/style.min.css"/>
<script type="text/javascript" src="../../js/script.min.js"></script>
</head>
<body onload="setupDdox();">
<header></header>
<nav id="main-nav">
<div>
<noscript>
<p style="color: red">The search functionality needs JavaScript enabled</p>
</noscript>
<div id="symbolSearchPane" style="display: none">
<form action="#" method="GET">
<input id="symbolSearch" type="text" name="q" placeholder="Search for symbols" autocomplete="off" onchange="performSymbolSearch(24);" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();" autofocus/>
</form>
<ul id="symbolSearchResults" class="symbolList" style="display: none"></ul><script type="application/javascript" src="../../symbols.js"></script><script type="application/javascript">var symbolSearchRootDir = "../../";
document.getElementById('symbolSearchPane').style.display = 'block';</script>
</div>
<ul class="tree-view">
<li class="tree-view ">
<div class="package ">
<a href="../../serverino.html">serverino</a>
</div>
<ul class="tree-view">
<li>
<div class="module selected">
<a href="../../serverino/config.html">config</a>
</div>
</li>
<li>
<div class="module ">
<a href="../../serverino/interfaces.html">interfaces</a>
</div>
</li>
</ul>
</li>
</ul>
</div>
<p id="main-nav-footer">
Built with
<a href="https://github.com/MartinNowak/scod">scod</a>
</p>
</nav>
<div id="main-contents">
<div>
<h1>Enum onWorkerException</h1><p>UDA. Functions with @onWorkerException attached are called when worker throws an exception
</p>
<div class="prototype">
<code class="lang-d">
<div class="single-prototype">
<span class="kwd">enum</span> <span class="typ">onWorkerException</span>
<span class="pun">:</span> <span class="typ">void</span> <span class="pun">{ ... }</span>
</div>
</code>
</div>
<section><pre class="code"><code class="lang-d"><span class="pun">@</span><span class="pln">onWorkerException </span><span class="typ">bool </span><span class="pln">myExceptionHandler</span><span class="pun">(</span><span class="typ">Request </span><span class="pln">r</span><span class="pun">, </span><span class="typ">Output </span><span class="pln">o</span><span class="pun">, </span><span class="typ">Exception </span><span class="pln">e</span><span class="pun">)
{
</span><span class="pln">o<wbr/></span><span class="pun">.</span><span class="pln">status </span><span class="pun">= </span><span class="lit">500</span><span class="pun">;
</span><span class="pln">info</span><span class="pun">(</span><span class="str">"Oh no! An exception occurred: "</span><span class="pun">, </span><span class="pln">e<wbr/></span><span class="pun">.</span><span class="pln">msg</span><span class="pun">);
</span><span class="kwd">return true</span><span class="pun">; </span><span class="com">// This means the exception is handled, if false, the exception is rethrown
</span><span class="pun">}</span></code></pre>
</section>

<section><h2>Enum members</h2>
<table>
<col class="caption"/>
<tr>
<th>Name</th><th>Description</th>
</tr>
</table>
</section>

</div>
<footer>
<div id="license-info">



</div>
</footer>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/serverino/interfaces/Request.buildId.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h1>Enum member Request.buildId</h1><p>Every time you compile the app this value
&nbsp;&nbsp;<span class="com">// ...</span>
<br/>
&nbsp;&nbsp;<span class="kwd">enum</span> <span class="pln">buildId</span>
<span class="pun">=</span> <span class="str">"9ad9726cd15b53dc96290b81c04147f6"</span><span class="pun">;</span>
<span class="pun">=</span> <span class="str">"ef9123aea04b193ece6a08ea8d005546"</span><span class="pun">;</span>
<br/>
&nbsp;&nbsp;<span class="com">// ...</span>
<br/>
Expand Down
7 changes: 7 additions & 0 deletions docs/serverino/interfaces/Request.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ <h1>Struct Request</h1><p>A request from user. Do not store ref to this struct a
<a href="../../serverino/interfaces/Request.host.html" class="public property"><code>host</code></a><span class="tableEntryAnnotation">[get]</span>
</td>
<td class="typecol"><code class="prettyprint lang-d"><span class="kwd">const</span><span class="pun">(</span><span class="typ">string</span><span class="pun">)</span></code></td><td>The host that received the request
</td>
</tr>
<tr>
<td>
<a href="../../serverino/interfaces/Request.id.html" class="public property"><code>id</code></a><span class="tableEntryAnnotation">[get]</span>
</td>
<td class="typecol"><code class="prettyprint lang-d"><span class="typ">string</span></code></td><td>The request ID. It is unique for each request.
</td>
</tr>
<tr>
Expand Down
72 changes: 72 additions & 0 deletions docs/serverino/interfaces/Request.id.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"/>
<title>Function Request.id</title>
<link rel="stylesheet" href="../../css/style.min.css"/>
<script type="text/javascript" src="../../js/script.min.js"></script>
</head>
<body onload="setupDdox();">
<header></header>
<nav id="main-nav">
<div>
<noscript>
<p style="color: red">The search functionality needs JavaScript enabled</p>
</noscript>
<div id="symbolSearchPane" style="display: none">
<form action="#" method="GET">
<input id="symbolSearch" type="text" name="q" placeholder="Search for symbols" autocomplete="off" onchange="performSymbolSearch(24);" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();" autofocus/>
</form>
<ul id="symbolSearchResults" class="symbolList" style="display: none"></ul><script type="application/javascript" src="../../symbols.js"></script><script type="application/javascript">var symbolSearchRootDir = "../../";
document.getElementById('symbolSearchPane').style.display = 'block';</script>
</div>
<ul class="tree-view">
<li class="tree-view ">
<div class="package ">
<a href="../../serverino.html">serverino</a>
</div>
<ul class="tree-view">
<li>
<div class="module ">
<a href="../../serverino/config.html">config</a>
</div>
</li>
<li>
<div class="module selected">
<a href="../../serverino/interfaces.html">interfaces</a>
</div>
</li>
</ul>
</li>
</ul>
</div>
<p id="main-nav-footer">
Built with
<a href="https://github.com/MartinNowak/scod">scod</a>
</p>
</nav>
<div id="main-contents">
<div>
<h1>Function Request.id</h1><p>The request ID. It is unique for each request.
</p>
<div class="prototype">
<code class="lang-d">
<div class="single-prototype">
<span class="typ">string</span> <span class="pln">id</span><span class="pun">(</span><span class="pun">)</span><span class="pln"> </span><span class="kwd">@property @safe const</span><span class="pun">;</span>
</div>
</code>
</div>


</div>
<footer>
<div id="license-info">



</div>
</footer>
</div>
</body>
</html>
3 changes: 3 additions & 0 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
<url><loc>http://127.0.0.1/index.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config/endpoint.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config/Fallthrough.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config/onDaemonStart.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config/onDaemonStop.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config/onServerInit.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config/onWebSocketStart.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config/onWebSocketStop.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config/onWebSocketUpgrade.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config/onWorkerException.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config/onWorkerStart.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config/onWorkerStop.html</loc></url>
<url><loc>http://127.0.0.1/serverino/config/priority.html</loc></url>
Expand Down Expand Up @@ -80,6 +82,7 @@
<url><loc>http://127.0.0.1/serverino/interfaces/Request.get.html</loc></url>
<url><loc>http://127.0.0.1/serverino/interfaces/Request.header.html</loc></url>
<url><loc>http://127.0.0.1/serverino/interfaces/Request.host.html</loc></url>
<url><loc>http://127.0.0.1/serverino/interfaces/Request.id.html</loc></url>
<url><loc>http://127.0.0.1/serverino/interfaces/Request.Method.html</loc></url>
<url><loc>http://127.0.0.1/serverino/interfaces/Request.method.html</loc></url>
<url><loc>http://127.0.0.1/serverino/interfaces/Request.password.html</loc></url>
Expand Down
5 changes: 5 additions & 0 deletions docs/symbols.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cc64c42

Please sign in to comment.