I have a Rails 5 app with ActionCable and Devise gem hosted on Heroku with 15K users. Many users have suggested to release a mobile app for the website. I want to start by creating a basic mobile app for the website.
When I google, all I get is API only guide. Are there any tutorials or books or any resource that show how to create a REST API for an existing Rails app?
Can someone kindly guide on how to do this? How do I authenticate users? How do I use real-time chat? Should I use any gem? Kindly share how to start and the best practices. Thanks
Are there any tutorials or books or any resource that show how to create a REST API for an existing Rails app?
Yes. This Railscast is very helpful. He goes through how to set up the basic parts of a restful API for an already functioning (albeit very simple) Rails app.
It's a few years old, but should still work for Rails 5.
I spent days trying to figure this out myself. Eventually I was able to do it using the gems 'grape', 'rack-cors', and 'grape-active_model_serializer' and wrote up a quick tutorial. Should work for Rails 5.2 and 6.0. You can check it out here: https://medium.com/@ryanwaldorf/how-to-add-an-api-to-an-existing-rails-app-1d2419ba91bd
Hope this helps everyone!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With