Welcome Guest, Not a member yet? Register   Sign In
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


Messages In This Thread
about API Response Trait - by Martin_Salas - 07-23-2019, 07:52 PM
RE: about API Response Trait - by ciadmin - 07-23-2019, 08:16 PM
RE: about API Response Trait - by Entai - 09-04-2019, 12:21 PM
RE: about API Response Trait - by ciadmin - 09-04-2019, 03:21 PM
RE: about API Response Trait - by Entai - 09-04-2019, 04:22 PM
RE: about API Response Trait - by InsiteFX - 09-04-2019, 03:24 PM
RE: about API Response Trait - by ciadmin - 09-04-2019, 03:48 PM
RE: about API Response Trait - by ciadmin - 09-04-2019, 04:52 PM
RE: about API Response Trait - by InsiteFX - 09-05-2019, 08:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB