Welcome Guest, Not a member yet? Register   Sign In
Poll: REST support?
You do not have permission to vote in this poll.
yes
84.52%
71 84.52%
no
9.52%
8 9.52%
maybe
5.95%
5 5.95%
Total 84 vote(s) 100%
* You voted for this item. [Show Results]

REST support
#11

(04-15-2015, 02:35 AM)sv3tli0 Wrote: Yes but it will be pointless to make anything more than an Interface and a rest router definition as all methods has to be covered 1 by 1 by devs.

How ever I already am not sure that anything from those things should be directly at the framework..

May be we have to think for CI extension support and half of the ci4 ideas to be extensions instead of build in features

I agree with this, I prefer a CI extension support and keep the core as uncluttered as possible. It could still be a "Official" extension created by the core team.
Reply
#12

(This post was last modified: 04-16-2015, 05:49 AM by RWCH.)

The following site does a really decent job explaining what REST is and gives a good example of what a RESTful API could look like: source: http://coreymaynard.com/blog/creating-a-...-with-php/

Their is not just one API and there is certainly no API suitable for all situations. CodeIgniter could offer some kind of 'all purpose API' which would suit most situations, like handling simple CRUD actions, BUT ...

CodeIgniter is a MVC-framework in which people are free to choose what their controller actions look like. So you should create a special kind of controller (RESTController?) or a controller which implements THE CodeIgniter RESTful interface.

I don't think that is the way to go and I agree with the last two comments. I really wonder how many of the voters created a RESTful API them self. Or were the voters thinking "REST is cool so CodeIgniter must support it?"

And another thing. REST has nothing to do with ORM ;-)
Reply
#13

Yup REST is required on CI
Reply
#14

(04-22-2015, 08:24 AM)alkarim Wrote: Yup REST is required on CI

Huh Well argumented.
Reply
#15

IMO having a separate Rest_Controller all together is not good, response formatter seems like good idea Yii has something similar, we need more input from the community.
Reply
#16

(This post was last modified: 05-04-2015, 06:33 AM by sv3tli0.)

Combination of some kind of special Route REST setting (where you just match url <=> controller) + REST Controller Interface is an option ..

(all default rest paths has to match this controller actions if exists else 404)

Laravel have good experience at that..

How ever all actions in the controller are custom matching your resources and there can't be any default version for defining Trait or Abstract controller or REST_Controller..
Best VPS Hosting : Digital Ocean
Reply
#17

REST is very important nowadays for a modern framework.
I think that REST service could have a separate controller handling, also because a separate controller for REST should be integrated with the routing part of the framework.
I explain it. For example ([pseudo-pseudo]-code Smile )


Code:
class Posts extends Codeigniter\Controller\RestController {
   public function get_index() {
       $this->response('json')->print('this is the response for GET request');
   }

   public function put_index() {
       $this->response('json')->print('this is the response for PUT request');
   }

   public function post_insert() {
       $this->response8'json')->print(this is the response for POST request for the action insert');

   // other methods
}

In this case, the routing could be automatic:
GET posts/index
PUT posts/index
POST posts/insert

and so on.

What do you think about it?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB