Pregunta

I need to creat a Rails API for a mobile app. The API will send and receive json formatted requests.

I would also like to create a back-end to manage the app. The back-end would use Rails with a user interface on desktop (admin).

I was wondering if there was a way to use the Rails-API gem in a Rails 4 app?

If so, how?

I know that to use Rails-API, one need to do the following :

class ApplicationController < ActionController::Api

end

By doing that, my admin interface would lack the Rails functionalities...

¿Fue útil?

Solución

You don't need rails-api to have a Rails Api. rails-api is only for when you ONLY want a rails-api with no rendering.

Read into using respond_with, active_model_serializers or rabl --- and you'll be able to have a JSON API as well as a normal Rails app.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top