Reputation: 187
I'm creating a JavaScript web app. I want to use Ruby on Rails to provide the API to the data in JSON format. I am writing the front-end entirely in JavaScript that will make Ajax calls to the API. This way, I will have a consistent data API when I can write different apps on different platforms.
I'm new to Ruby on Rails and I'm not sure if this is a good approach. If so, could you help me point to a good tutorial to implement the back-end that I just mentioned? If not, please help suggest a good way.
Upvotes: 4
Views: 4446
Reputation: 319
I didn't work with it yet, but the Rails-API gem by spastorino might be helpful.
Also there is a Railscast on this, so you might want to check this out as a starting point
Upvotes: 2
Reputation: 326
Api example code : https://github.com/pigon-web-services/api-app/blob/master/app/controllers/location_controller.rb
How to use this api with javascript : http://pigon.ws/examples/jsonp?api=locationapi
Upvotes: 2