Skip to content

Commit 4557bea

Browse files
committed
Update User Guide
1 parent ada744f commit 4557bea

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

guides/api/first-endpoint.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ <h2><a class="toc-backref" href="#id2" role="doc-backlink">Enable Improved Auto
320320
<div class="highlight-php notranslate"><div class="highlight"><pre><span></span><span class="x">public bool $autoRoute = true;</span>
321321
</pre></div>
322322
</div>
323-
<p>That’s all you need for CodeIgniter to automatically map your controller classes and to URIs like <code class="docutils literal notranslate"><span class="pre">GET</span> <span class="pre">/api/pings</span></code> or <code class="docutils literal notranslate"><span class="pre">POST</span> <span class="pre">/api/pings</span></code>.</p>
323+
<p>That’s all you need for CodeIgniter to automatically map your controller classes and to URIs like <code class="docutils literal notranslate"><span class="pre">GET</span> <span class="pre">/api/ping</span></code> or <code class="docutils literal notranslate"><span class="pre">POST</span> <span class="pre">/api/ping</span></code>.</p>
324324
</section>
325325
<section id="create-a-ping-controller">
326326
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Create a Ping Controller</a><a class="headerlink" href="#create-a-ping-controller" title="Link to this heading"></a></h2>
@@ -352,7 +352,7 @@ <h2><a class="toc-backref" href="#id3" role="doc-backlink">Create a Ping Control
352352
<p>Here we:</p>
353353
<ul class="simple">
354354
<li><p>Use the <code class="xref php php-class docutils literal notranslate"><span class="pre">ResponseTrait</span></code>, which already includes REST helpers such as <a class="reference internal" href="../../outgoing/api_responses.html#respond" title="respond"><code class="xref php php-meth docutils literal notranslate"><span class="pre">respond()</span></code></a> and proper status codes.</p></li>
355-
<li><p>Define a <code class="docutils literal notranslate"><span class="pre">getIndex()</span></code> method. The <code class="docutils literal notranslate"><span class="pre">get</span></code> prefix means it responds to <code class="docutils literal notranslate"><span class="pre">GET</span></code> requests, and the <code class="docutils literal notranslate"><span class="pre">Index</span></code> name means it matches the base URI (<code class="docutils literal notranslate"><span class="pre">/api/pings</span></code>).</p></li>
355+
<li><p>Define a <code class="docutils literal notranslate"><span class="pre">getIndex()</span></code> method. The <code class="docutils literal notranslate"><span class="pre">get</span></code> prefix means it responds to <code class="docutils literal notranslate"><span class="pre">GET</span></code> requests, and the <code class="docutils literal notranslate"><span class="pre">Index</span></code> name means it matches the base URI (<code class="docutils literal notranslate"><span class="pre">/api/ping</span></code>).</p></li>
356356
</ul>
357357
</section>
358358
<section id="test-the-route">
@@ -363,8 +363,8 @@ <h2><a class="toc-backref" href="#id4" role="doc-backlink">Test the route</a><a
363363
</div>
364364
<p>Now visit:</p>
365365
<ul class="simple">
366-
<li><p><strong>Browser:</strong> <code class="docutils literal notranslate"><span class="pre">http://localhost:8080/api/pings</span></code></p></li>
367-
<li><p><strong>cURL:</strong> <code class="docutils literal notranslate"><span class="pre">curl</span> <span class="pre">http://localhost:8080/api/pings</span></code></p></li>
366+
<li><p><strong>Browser:</strong> <code class="docutils literal notranslate"><span class="pre">http://localhost:8080/api/ping</span></code></p></li>
367+
<li><p><strong>cURL:</strong> <code class="docutils literal notranslate"><span class="pre">curl</span> <span class="pre">http://localhost:8080/api/ping</span></code></p></li>
368368
</ul>
369369
<p>Expected response:</p>
370370
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
@@ -376,9 +376,9 @@ <h2><a class="toc-backref" href="#id4" role="doc-backlink">Test the route</a><a
376376
</section>
377377
<section id="understand-how-it-works">
378378
<h2><a class="toc-backref" href="#id5" role="doc-backlink">Understand how it works</a><a class="headerlink" href="#understand-how-it-works" title="Link to this heading"></a></h2>
379-
<p>When you request <code class="docutils literal notranslate"><span class="pre">/api/pings</span></code>:</p>
379+
<p>When you request <code class="docutils literal notranslate"><span class="pre">/api/ping</span></code>:</p>
380380
<ol class="arabic simple">
381-
<li><p>The <strong>Improved Auto Router</strong> finds the <code class="docutils literal notranslate"><span class="pre">App\Controllers\Api\Pings</span></code> class.</p></li>
381+
<li><p>The <strong>Improved Auto Router</strong> finds the <code class="docutils literal notranslate"><span class="pre">App\Controllers\Api\Ping</span></code> class.</p></li>
382382
<li><p>It detects the HTTP verb (<code class="docutils literal notranslate"><span class="pre">GET</span></code>).</p></li>
383383
<li><p>It calls the corresponding method name: <code class="docutils literal notranslate"><span class="pre">getIndex()</span></code>.</p></li>
384384
<li><p><code class="xref php php-trait docutils literal notranslate"><span class="pre">ResponseTrait</span></code> provides helper methods to produce consistent output.</p></li>
@@ -391,9 +391,9 @@ <h2><a class="toc-backref" href="#id5" role="doc-backlink">Understand how it wor
391391
</tr>
392392
</thead>
393393
<tbody>
394-
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">GET</span> <span class="pre">/api/pings</span></code>
395-
<code class="docutils literal notranslate"><span class="pre">POST</span> <span class="pre">/api/pings</span></code>
396-
<code class="docutils literal notranslate"><span class="pre">DELETE</span> <span class="pre">/api/pings</span></code></p></td>
394+
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">GET</span> <span class="pre">/api/ping</span></code>
395+
<code class="docutils literal notranslate"><span class="pre">POST</span> <span class="pre">/api/ping</span></code>
396+
<code class="docutils literal notranslate"><span class="pre">DELETE</span> <span class="pre">/api/ping</span></code></p></td>
397397
<td><p><code class="docutils literal notranslate"><span class="pre">getIndex()</span></code>
398398
<code class="docutils literal notranslate"><span class="pre">postIndex()</span></code>
399399
<code class="docutils literal notranslate"><span class="pre">deleteIndex()</span></code></p></td>

0 commit comments

Comments
 (0)