Skip to content

Commit c4ade2c

Browse files
committed
class defined as "Ping" but endpoints trying to fetch "Pings"
1 parent 3f9f258 commit c4ade2c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/guides/api/first-endpoint.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ <h2><a class="toc-backref" href="#id2" role="doc-backlink">Enable Improved Auto
321321
<div class="highlight-php notranslate"><div class="highlight"><pre><span></span><span class="x">public bool $autoRoute = true;</span>
322322
</pre></div>
323323
</div>
324-
<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>
324+
<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>
325325
</section>
326326
<section id="create-a-ping-controller">
327327
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Create a Ping Controller</a><a class="headerlink" href="#create-a-ping-controller" title="Permalink to this heading"></a></h2>
@@ -353,7 +353,7 @@ <h2><a class="toc-backref" href="#id3" role="doc-backlink">Create a Ping Control
353353
<p>Here we:</p>
354354
<ul class="simple">
355355
<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>
356-
<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>
356+
<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>
357357
</ul>
358358
</section>
359359
<section id="test-the-route">
@@ -364,8 +364,8 @@ <h2><a class="toc-backref" href="#id4" role="doc-backlink">Test the route</a><a
364364
</div>
365365
<p>Now visit:</p>
366366
<ul class="simple">
367-
<li><p><strong>Browser:</strong> <code class="docutils literal notranslate"><span class="pre">http://localhost:8080/api/pings</span></code></p></li>
368-
<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>
367+
<li><p><strong>Browser:</strong> <code class="docutils literal notranslate"><span class="pre">http://localhost:8080/api/ping</span></code></p></li>
368+
<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>
369369
</ul>
370370
<p>Expected response:</p>
371371
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
@@ -377,9 +377,9 @@ <h2><a class="toc-backref" href="#id4" role="doc-backlink">Test the route</a><a
377377
</section>
378378
<section id="understand-how-it-works">
379379
<h2><a class="toc-backref" href="#id5" role="doc-backlink">Understand how it works</a><a class="headerlink" href="#understand-how-it-works" title="Permalink to this heading"></a></h2>
380-
<p>When you request <code class="docutils literal notranslate"><span class="pre">/api/pings</span></code>:</p>
380+
<p>When you request <code class="docutils literal notranslate"><span class="pre">/api/ping</span></code>:</p>
381381
<ol class="arabic simple">
382-
<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>
382+
<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>
383383
<li><p>It detects the HTTP verb (<code class="docutils literal notranslate"><span class="pre">GET</span></code>).</p></li>
384384
<li><p>It calls the corresponding method name: <code class="docutils literal notranslate"><span class="pre">getIndex()</span></code>.</p></li>
385385
<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>
@@ -392,9 +392,9 @@ <h2><a class="toc-backref" href="#id5" role="doc-backlink">Understand how it wor
392392
</tr>
393393
</thead>
394394
<tbody>
395-
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">GET</span> <span class="pre">/api/pings</span></code>
396-
<code class="docutils literal notranslate"><span class="pre">POST</span> <span class="pre">/api/pings</span></code>
397-
<code class="docutils literal notranslate"><span class="pre">DELETE</span> <span class="pre">/api/pings</span></code></p></td>
395+
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">GET</span> <span class="pre">/api/ping</span></code>
396+
<code class="docutils literal notranslate"><span class="pre">POST</span> <span class="pre">/api/ping</span></code>
397+
<code class="docutils literal notranslate"><span class="pre">DELETE</span> <span class="pre">/api/ping</span></code></p></td>
398398
<td><p><code class="docutils literal notranslate"><span class="pre">getIndex()</span></code>
399399
<code class="docutils literal notranslate"><span class="pre">postIndex()</span></code>
400400
<code class="docutils literal notranslate"><span class="pre">deleteIndex()</span></code></p></td>

0 commit comments

Comments
 (0)