All Comments
TopTalkedBooks posted at August 20, 2017

I recently found myself pondering similar questions, how best to modularise a large application. As a relative Ruby newcomer (< a year), I dabbled with writing Rails APIs, and consuming them with ActiveResource. It didn't feel quite right to me, Rails felt too bloated for the APIs and ActiveResource felt too generic and incomplete for the client.

Then, I read Service Oriented Design with Ruby and Rails - Paul Dix, and it was like an epiphany! It covers your specific question of pros, cons & the theory very early on (chapter 1 I think), and does it very well.

TopTalkedBooks posted at August 20, 2017

In few words – an a very practical, non academic explanation – a RESTful web service is a web server that answer requests that are structured following a :resource/:action/[:id] pattern.

For example, your users are a resource and you have these actions:

  • GET /users : list of users
  • GET /users/5000/edit : Edit a specific user
  • GET /users/5000 : Show a specific user
  • GET /users/new : Form for creating a new user
  • POST /users/ : A post request that created a new user.
  • PUT /users/5000 : A Post request that updates an user.
  • DELETE /users/5000 : A destroy request that removes an user.

It is a CRUD interface: Create, Read, Update, Destroy.

Your sessions are resources too.

  • POST /session/create : Create a new session for a user.
  • DELETE /session/destroy : Removes a session.

Some resources do not need to be have all CRUD actions.

For the original document that describes the RESTful architecture:

For a more practical examination of this matter:

TopTalkedBooks posted at August 20, 2017

Brandon Hilkert has been doing some posts about this topic. You can check them out here. There are also some books available on Amazon like this one. StichFix also created a gem to somewhat assist in this.

Top Books
We collected top books from hacker news, stack overflow, Reddit, which are recommended by amazing people.