cbmeeks
cbmeeks

Reputation: 11420

How do I use Rails as purely a JSON application server with a Backbone UI?

I'm starting a new web app. I've decided that with using Twitter Bootstrap I can actually make this app look pretty good! So this has inspired me to really focus on the user experience of the app. Really polish it and make it shine.

So, naturally, there is going to be a lot of front-end JS work. Being a Rails 3 fan, I thought about using Rails (along with its generators, easy ActiveRecord, etc) as just a backend platform for working with JSON. So Backbone would perform CRUD operations and Rails would handle the server-side stuff.

In fact, I don't even want to use Rails' template system. I thought about just using pure HTML and serve them statically with nginx.

Backbone and jQuery would be responsible for updating sections of the pages.

Is my logic sane? The main reason I want to do this is that I want a pure, front-end, experience that the user will enjoy. Plus, the nature of my app really lends well to no page refreshes.

Upvotes: 2

Views: 220

Answers (1)

John Munsch
John Munsch

Reputation: 19528

Sure, that would work fine. You can do basically that same thing with just about any language and server on the backend these days including Node.js, Rails, Java with something like Jersey (that's what we use), PHP, etc.

The Backbone front end just treats the back end as a query and persistence service that it accesses via URLs. Serve up JSON data from those URLs and Backbone will be happy as a clam.

Upvotes: 1

Related Questions