Using Grape with Rails

2019-03-04 10:12发布

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条回答
趁早两清
2楼-- · 2019-03-04 11:07

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.

查看更多
登录 后发表回答