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 @@
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.
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).
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:
-The Improved Auto Router finds the App\Controllers\Api\Pings class.
+The Improved Auto Router finds the App\Controllers\Api\Ping class.
It detects the HTTP verb (GET).
It calls the corresponding method name: getIndex().
ResponseTrait provides helper methods to produce consistent output.
@@ -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()