diff --git a/docs/guides/api/first-endpoint.html b/docs/guides/api/first-endpoint.html index a0aa2844..f9099c09 100644 --- a/docs/guides/api/first-endpoint.html +++ b/docs/guides/api/first-endpoint.html @@ -321,7 +321,7 @@

Enable Improved Auto
public bool $autoRoute = true;
 
-

That’s all you need for CodeIgniter to automatically map your controller classes and to URIs like GET /api/pings or POST /api/pings.

+

That’s all you need for CodeIgniter to automatically map your controller classes and to URIs like GET /api/ping or POST /api/ping.

Create a Ping Controller

@@ -353,7 +353,7 @@

Create a Ping Control

Here we:

  • Use the ResponseTrait, which already includes REST helpers such as respond() and proper status codes.

  • -
  • Define a getIndex() method. The get prefix means it responds to GET requests, and the Index name means it matches the base URI (/api/pings).

  • +
  • Define a getIndex() method. The get prefix means it responds to GET requests, and the Index name means it matches the base URI (/api/ping).

@@ -364,8 +364,8 @@

Test the route

Now visit:

    -
  • Browser: http://localhost:8080/api/pings

  • -
  • cURL: curl http://localhost:8080/api/pings

  • +
  • Browser: http://localhost:8080/api/ping

  • +
  • cURL: curl http://localhost:8080/api/ping

Expected response:

{
@@ -377,9 +377,9 @@ 

Test the route

Understand how it works

-

When you request /api/pings:

+

When you request /api/ping:

    -
  1. The Improved Auto Router finds the App\Controllers\Api\Pings class.

  2. +
  3. The Improved Auto Router finds the App\Controllers\Api\Ping class.

  4. It detects the HTTP verb (GET).

  5. It calls the corresponding method name: getIndex().

  6. ResponseTrait provides helper methods to produce consistent output.

  7. @@ -392,9 +392,9 @@

    Understand how it wor -

    GET /api/pings -POST /api/pings -DELETE /api/pings

    +

    GET /api/ping +POST /api/ping +DELETE /api/ping

    getIndex() postIndex() deleteIndex()