Transferring data from the baseline to CodeIgniter

I'm having problems transferring data from Backbone to the CodeIgniter application ... After calling the Backbone save()or methods sync()and checking the request headers in Chrome tools, it seems like Backbone sends data to the server using the Request payload, rather than the standard data form approach, which jQuery and standard HTML forms are represented using.

If I turn it on Backbone.emulateJSON(), the message is sent through the form data, and I can get the data in $this->input->post('model'), as expected. Then I can call json_decode()on this data and be on my way. However, this will violate my implementation of the CodeIgniter validation library. I keep my validation rules in separate files, and behind the scenes they expect the data to be in $this->input->post(), not $this->input->post('model');

I studied using the Restserver Phil Sturgeon library. It looks like this will allow me to delete Backbone.emulateHTTP()by processing requests PUTand DELETE. However, I still need to call $this->post('model'), checking will still be broken, and actually check is not supported, even for queries PUTand DELETEin the library!

I'm starting to think that CodeIgniter has a biscuit and will not support my foreground needs. I stuck with CodeIgniter because by this time I was used to this architecture and the Datamapper ORM is so wonderful.

Suggestions on how to proceed? I am open to all backend file sharing if your offer comes with an elegant RESTful implementation that works with Backbone by default, has a strong ORM and extensive validation / XSS libraries. Or, if you can solve my CodeIgniter dilemma, this works too.

+3
source share
2 answers

Check the implementation of the control code controller to fix Phil Sturgeon errors.

https://github.com/philsturgeon/codeigniter-restserver

Slim , .

+1
0

All Articles