You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>That’s all you need for CodeIgniter to automatically map your controller classes and to URIs like <codeclass="docutils literal notranslate"><spanclass="pre">GET</span><spanclass="pre">/api/pings</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">POST</span><spanclass="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 <codeclass="docutils literal notranslate"><spanclass="pre">GET</span><spanclass="pre">/api/ping</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">POST</span><spanclass="pre">/api/ping</span></code>.</p>
325
325
</section>
326
326
<sectionid="create-a-ping-controller">
327
327
<h2><aclass="toc-backref" href="#id3" role="doc-backlink">Create a Ping Controller</a><aclass="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
353
353
<p>Here we:</p>
354
354
<ulclass="simple">
355
355
<li><p>Use the <codeclass="xref php php-class docutils literal notranslate"><spanclass="pre">ResponseTrait</span></code>, which already includes REST helpers such as <aclass="reference internal" href="../../outgoing/api_responses.html#respond" title="respond"><codeclass="xref php php-meth docutils literal notranslate"><spanclass="pre">respond()</span></code></a> and proper status codes.</p></li>
356
-
<li><p>Define a <codeclass="docutils literal notranslate"><spanclass="pre">getIndex()</span></code> method. The <codeclass="docutils literal notranslate"><spanclass="pre">get</span></code> prefix means it responds to <codeclass="docutils literal notranslate"><spanclass="pre">GET</span></code> requests, and the <codeclass="docutils literal notranslate"><spanclass="pre">Index</span></code> name means it matches the base URI (<codeclass="docutils literal notranslate"><spanclass="pre">/api/pings</span></code>).</p></li>
356
+
<li><p>Define a <codeclass="docutils literal notranslate"><spanclass="pre">getIndex()</span></code> method. The <codeclass="docutils literal notranslate"><spanclass="pre">get</span></code> prefix means it responds to <codeclass="docutils literal notranslate"><spanclass="pre">GET</span></code> requests, and the <codeclass="docutils literal notranslate"><spanclass="pre">Index</span></code> name means it matches the base URI (<codeclass="docutils literal notranslate"><spanclass="pre">/api/ping</span></code>).</p></li>
357
357
</ul>
358
358
</section>
359
359
<sectionid="test-the-route">
@@ -364,8 +364,8 @@ <h2><a class="toc-backref" href="#id4" role="doc-backlink">Test the route</a><a
@@ -377,9 +377,9 @@ <h2><a class="toc-backref" href="#id4" role="doc-backlink">Test the route</a><a
377
377
</section>
378
378
<sectionid="understand-how-it-works">
379
379
<h2><aclass="toc-backref" href="#id5" role="doc-backlink">Understand how it works</a><aclass="headerlink" href="#understand-how-it-works" title="Permalink to this heading"></a></h2>
380
-
<p>When you request <codeclass="docutils literal notranslate"><spanclass="pre">/api/pings</span></code>:</p>
380
+
<p>When you request <codeclass="docutils literal notranslate"><spanclass="pre">/api/ping</span></code>:</p>
381
381
<olclass="arabic simple">
382
-
<li><p>The <strong>Improved Auto Router</strong> finds the <codeclass="docutils literal notranslate"><spanclass="pre">App\Controllers\Api\Pings</span></code> class.</p></li>
382
+
<li><p>The <strong>Improved Auto Router</strong> finds the <codeclass="docutils literal notranslate"><spanclass="pre">App\Controllers\Api\Ping</span></code> class.</p></li>
383
383
<li><p>It detects the HTTP verb (<codeclass="docutils literal notranslate"><spanclass="pre">GET</span></code>).</p></li>
384
384
<li><p>It calls the corresponding method name: <codeclass="docutils literal notranslate"><spanclass="pre">getIndex()</span></code>.</p></li>
385
385
<li><p><codeclass="xref php php-trait docutils literal notranslate"><spanclass="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
0 commit comments