Skip to content

Commit

Permalink
deploy: c6f224e
Browse files Browse the repository at this point in the history
  • Loading branch information
noelwelsh committed Feb 1, 2024
1 parent 3daff97 commit 1c0da55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion routes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h2 id="constructing-a-route" class="section">Constructing A Route</h2>
<h3 id="type-transformations-for-handlers" class="section">Type Transformations for Handlers</h3>
<p>If you dig into the types produced by <code>Requests</code>, you notice a lot of tuple types are used. Here&#39;s an example, showing a <code>Request</code> producing a <code>Tuple2</code>.</p>
<pre><code class="nohighlight"><span class="keyword">val</span><span> </span><span class="identifier">request</span><span> = </span><span class="type-name">Request</span><span>.</span><span class="identifier">get</span><span>(</span><span class="type-name">Path</span><span>.</span><span class="identifier">root</span><span> / </span><span class="type-name">Param</span><span>.</span><span class="identifier">int</span><span> / </span><span class="type-name">Param</span><span>.</span><span class="identifier">string</span><span>)
</span><span class="comment">// request: Request[*:[Int, *:[String, EmptyTuple]], Unit, Unit, Unit] = krop.route.Request@3e606b49</span></code></pre>
</span><span class="comment">// request: Request[*:[Int, *:[String, EmptyTuple]], Unit, Unit, Unit] = krop.route.Request@2cc0f214</span></code></pre>
<p>However, when you come to use a handler with such a request, you can use a normal function with two arguments <em>not</em> a function that accepts a single <code>Tuple2</code>.</p>
<pre><code class="nohighlight"><span class="type-name">Route</span><span>(</span><span class="identifier">request</span><span>, </span><span class="type-name">Response</span><span>.</span><span class="identifier">ok</span><span>(</span><span class="type-name">Entity</span><span>.</span><span class="identifier">text</span><span>))
.</span><span class="identifier">handle</span><span>((</span><span class="identifier">int</span><span>, </span><span class="identifier">string</span><span>) =&gt; </span><span class="string-literal">s&quot;</span><span class="substitution">${int.toString}</span><span class="string-literal">: </span><span class="substitution">${string}</span><span class="string-literal">&quot;</span><span>)</span></code></pre>
Expand Down
4 changes: 2 additions & 2 deletions routes/paths.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ <h2 id="matching-all-segments" class="section">Matching All Segments</h2>
//
// A path is closed when it has a segment or parameter that matches all remaining elements.
// A closed path cannot have additional segments of parameters added to it.
// at krop.route.Path.assertOpen(Path.scala:250)
// at krop.route.Path.$div(Path.scala:223)
// at krop.route.Path.assertOpen(Path.scala:247)
// at krop.route.Path.$div(Path.scala:220)
// at repl.MdocSession$MdocApp.$init$$$anonfun$1(paths.md:41)</span></code></pre>

<h2 id="params" class="section">Params</h2>
Expand Down

0 comments on commit 1c0da55

Please sign in to comment.