Where I can find guidance on best practices for naming API method calls?


#1

I’m rewriting an old Rails application in Ember CLI. I’m using Rails to build the API that the Ember CLI app will access.

What I can’t figure out is how to build the API so that the urls are constructed correctly in my controllers (or routes? still new). I’m not sure if I’m supposed to build this API with a traditional REST architecture, or if I can just use method names like “get_products” or “update_product”.

I’m happy to RTFM if I can just find one. Your help is appreciated!


#2

Hey Convert, do you mean the method names on the Rails API?

If I were to rewrite an app, I would follow Rails conventions, use active_model_serializers or jsonapi-resources to expose the API as JSON API. Ember Data will happily consume such an API.

Edit: If interested in pursuing that path, you may want to read my guide http://emberigniter.com/modern-bridge-ember-and-rails-5-with-json-api/