Hi,

API is no different from your regular rails controller / actions. As both
respond to a particular request but API doesn't use sessions. so your
currrent_user is created from token, not sessions. for angular as the front
end, you dont have to create an api. Your regular routes works fine .  If
you still want to turn your app into API they you can use grape gem
<https://github.com/intridea/grape> . I will help you set up the
boilerplate.

Cheers

On Fri, Dec 26, 2014 at 2:43 AM, tonyb <[email protected]> wrote:

> Hi all,
>
> I might need your advise on this.
>
> I've been working on an web app and I'm wondering how to turn it into a
> api based application.
>
> What's the best practice?
>
> imagin I have a articles resource
>
> do I create a articles controller with empty actions, then an
> api::articles_controller which will take care of the data computations, and
> then from my views call the api to get the data in json format so I can use
> angular for example on the frontend?
>
> How would you implemente it?
>
> Thanks for your contribution
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/322df10f-2f2c-4b5f-bd69-f4177af169cb%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/322df10f-2f2c-4b5f-bd69-f4177af169cb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAFKVRj9h-tEamPKp%3D2p8iGs4tJEN%2Ba-xZQ-Gpp6qxGYPZJwhoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to