kytrinyx/exercism.io — pull request #477 by Maxim-Filimonov (2013-08-14 17:57:33+00:00)
Title: Internal API structure

I've been working on inline editing functionality and realised that there are some changes required to the structure of the app to make it work.

The most common way to structure dynamic angular views is the following:
1. Load initial data from server using JSON.
2. Display the data to the view using binding.
3. Change data in model.
4. Save changes in model using JSON api back to the server.

So for the step number 1 I need to introduce a GET API which will give to a view a list of nitpicks and comments and move the actual rendering of it to the client. There are a couple of approaches with current app structure I see.
- Add the new API to api.rb which won't require API key and will return nitpicks and comments for requested submission_id
- Add the new API to submissions.rb which will somehow(Rack::AcceptFormat as an option) will detect when headers contain accept: 'application/json' and return JSON response for requested submission_id

I'm leaning towards second option but it might require additional library - 'rack-contrib'.
@kytrinyx, @theotherzach any thoughts?