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.