How to use Backbone.js with a Symfony and or Apache Thrift map

I recently installed a web application using the Symfony2 framework and Apache Thrift .

Now I would like to make the base station usable within Symfony2 .

My question is about Backbone.sync .

  • How can I override / use Backbone.sync to get data from a server in a web application using the Symfony2 framework and / or Apache Thrift ?

  • Are there any tutorials on the Internet for this? I just found this Symfony + Backbone.js for highly dynamic applications , but it says nothing about how to get data from the server.

+7
source share
2 answers

By default, Backbone.js and its synchronization method can work with the REST API without any changes. Therefore, if you can create a web service with Symfony2 that can handle GET / POST / PUT / DELETE and return JSON, you should be good to go.

I'm not very familiar with Symfony, but for the basic REST API you need to define URL routes (for example, "www.yourdomain.com/api/items") and then create methods to perform actions based on these routes (for example, entries return in JSON encoded format).

Here's a quick guide to creating a REST API with Symfony2: Symfony2 REST

Also, check out the Wine Cellar tutorial on the Backbone tutorial page. It uses the PHP Slim framework, but the concepts of backbone.js will be exactly the same because, as long as you use the basic REST API, the backbone is agnostic to the back-end.

+5
source

Check out this package https://github.com/gigo6000/DevtimeRafflerBundle is a small simple application that includes some basic REST actions. This was created using https://github.com/gigo6000/DevtimeBackboneBundle

+3
source

All Articles