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>
323
+
<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>
324
324
</section>
325
325
<sectionid="create-a-ping-controller">
326
326
<h2><aclass="toc-backref" href="#id3" role="doc-backlink">Create a Ping Controller</a><aclass="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
352
352
<p>Here we:</p>
353
353
<ulclass="simple">
354
354
<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>
355
-
<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>
355
+
<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>
356
356
</ul>
357
357
</section>
358
358
<sectionid="test-the-route">
@@ -363,8 +363,8 @@ <h2><a class="toc-backref" href="#id4" role="doc-backlink">Test the route</a><a
@@ -376,9 +376,9 @@ <h2><a class="toc-backref" href="#id4" role="doc-backlink">Test the route</a><a
376
376
</section>
377
377
<sectionid="understand-how-it-works">
378
378
<h2><aclass="toc-backref" href="#id5" role="doc-backlink">Understand how it works</a><aclass="headerlink" href="#understand-how-it-works" title="Link to this heading"></a></h2>
379
-
<p>When you request <codeclass="docutils literal notranslate"><spanclass="pre">/api/pings</span></code>:</p>
379
+
<p>When you request <codeclass="docutils literal notranslate"><spanclass="pre">/api/ping</span></code>:</p>
380
380
<olclass="arabic simple">
381
-
<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>
381
+
<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>
382
382
<li><p>It detects the HTTP verb (<codeclass="docutils literal notranslate"><spanclass="pre">GET</span></code>).</p></li>
383
383
<li><p>It calls the corresponding method name: <codeclass="docutils literal notranslate"><spanclass="pre">getIndex()</span></code>.</p></li>
384
384
<li><p><codeclass="xref php php-trait docutils literal notranslate"><spanclass="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
0 commit comments