Application based on an api

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

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