• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
about API Response Trait

#1
I was using tests in CI3, with the codeigniter-restserver library and I liked the following implementation:

class Books extends CI_Controller
{
  use REST_Controller {
   REST_Controller::__construct as private __resTraitConstruct;
 }
 public function index_get()
 {
   // Display all books
 }

 public function index_post()
 {
   // Create a new book
 }

public function index_delete($id)
{

  // Delete a book
}
}


What I like is that: the method names will be appended with the HTTP method used to access the request. If you're making an HTTP GET call to /books, for instance, it would call a Books#index_get() method.

Is it possible for CI4 to work this way?

link:  https://github.com/chriskacerguis/codeig...restserver 
Reply

#2
The intent is to have something that matches the HTTP verbs more closely.

That will find its way into the develop branch, hopefully before RC1. It might not be in exactly that form, but it should be close. We just need time and unit testing Undecided

EDIT: The links that were originally here referred to code that has since been merged. The RESTful stuff is described here... https://codeigniter4.github.io/userguide...stful.html
Reply

#3
(07-23-2019, 08:16 PM)ciadmin Wrote: The intent is to have something that matches the HTTP verbs more closely. **Obsolete links removed; see modified message above.**

That will find its way into the develop branch, hopefully before RC1. It might not be in exactly that form, but it should be close. We just need time and unit testing Undecided

Now with the release of the RC1 how I use the REST api??? where I can find info of that
Reply

#4
https://codeigniter4.github.io/userguide...stful.html
Reply

#5
Both of those links are giving me an 404 Error page at 6:24 pm EST.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#6
(09-04-2019, 03:24 PM)InsiteFX Wrote: Both of those links are giving me an 404 Error page at 6:24 pm EST.

Very weird ... I see no problem here, and Cloudflare is not reporting anything.
I don't know what to suggest.
Reply

#7
(09-04-2019, 03:21 PM)ciadmin Wrote: https://codeigniter4.github.io/userguide...stful.html

Thx!! ... 

PS: Both link on the first reply are 404 to me too!
Reply

#8
@InsiteFX @Entai The links that were originally here referred to code that has since been merged; that is why they didn't work. The RESTful stuff is described here... https://codeigniter4.github.io/userguide...stful.html
Reply

#9
Thanks ciadmiin.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.