Wondering if anyone has had any experiences with these gems?
Or can you recommend a better one to help me add a restful API to my app?
Thanks.
Here's a few to checkout:
Grape - A bit like Sinatra but for building APIs. Built on top of Rack with minimal dependencies.
Rocket Pants - A set of tools for building APIs alongside Rails, inspired by Grape but with deeper Rails and ActionPack integration
Rails::API - Rails minus the stuff not needed for building apis.
I used Grape on a few projects, and I found it pretty good for small to medium APIs, especially if you want to add an API on top of an existing rails app, prefer a clean separation from your rails controllers and still be able to share model logic between the two.
It's like Sinatra which means defining endpoints is straight-forward and flexible, which can be a good or bad thing. On bigger APIs things can get a bit messy if you're not disciplined.
In comparison Rocket Pants is a little bit more opinionated, which gives you more structure and out of the box features. With Grape, as your API grows, you will need to find a way to refactor and structure the code yourself.
There's a bunch of information on this topic on RailsCast:
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