Using Grape with Rails

2019-03-04 10:09发布

问题:

I am planning for an API app in Rails using Grape micro-framework. Is it a good idea to use Grape with Rails. Are there any prerequisites that I should take care of?

回答1:

Depends on your long term goal of what you are planning to do with your API. If you want to make a stable API and maintain that for the long term use, I don't recommend grape (from my personal experience). I have used grape in one big project, and it was too hard to work with it when it comes to customizations e.g. handing exceptions etc. Instead you should consider using ActiveModelSerializer or jbuilder. I personally moved to ActiveModelSerializer from Grape, and was happy at the end. grape is good for building your API quickly as it provides a decent DSL, but in the long run, it was hard to maintain and add new features and customizations. So, it really depends on your long term goal.