Application based on an api

20 views
Skip to first unread message

tonyb

unread,
Dec 25, 2014, 4:13:02 PM12/25/14
to rubyonra...@googlegroups.com
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

Vivek Sampara

unread,
Dec 25, 2014, 11:52:06 PM12/25/14
to rubyonra...@googlegroups.com
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 . I will help you set up the boilerplate.

Cheers

--
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 rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/322df10f-2f2c-4b5f-bd69-f4177af169cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages