What are RESTful routes?

A REST application program interface(API) is an interface style that has a set of constraints. These constraints must be satisfied in order to consider it to be RESTful. When these constraints are properly followed, the product would be an application with specific properties. These properties will result in better performance and reliability.

Constraints- in simple words or less…

  1. Client–server- The client/server application must be separated and able to progress without depending on each other.
  2. Stateless- all client server interactions are stateless. If state management is needed, it should take place on the client. The server does not need context of what state the client is in.
  3. Uniform interface- Predictability, utilizing proper HTTP Verbs, self descriptive, and uniform- like exposure to resources
  4. Cacheable- Caching should be allowed on all resources unless distinctively told not possible
  5. Layered system- Layered style architecture made from hierarchical layers of servers.

RESTful Routing

In the image above, is a table describing the our Seven routes. Each route supply’s mapping between HTTP verbs and our controller actions.These Routes receive request(GET/POST/PATCH/DELETE) and determines what needs to be sent back. Although not the same, CRUD(Create, Read, Update, delete) can be synonymous to our action names. These seven routes are responsible for access and manipulating our resources. Since our routes and have already been assigned, CRUD allows us to focus more on the app itself .

https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.edureka.co%2Fblog%2Fwhat-is-rest-api%2F&psig=AOvVaw02E8PCx-vq12wpc8zNxRcG&ust=1615494413657000&source=images&cd=vfe&ved=0CAIQjRxqFwoTCKjIzuvHpu8CFQAAAAAdAAAAABAD
https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.edureka.co%2Fblog%2Fwhat-is-rest-api%2F&psig=AOvVaw02E8PCx-vq12wpc8zNxRcG&ust=1615494413657000&source=images&cd=vfe&ved=0CAIQjRxqFwoTCKjIzuvHpu8CFQAAAAAdAAAAABAD

CRUD takes care of these four actions, and can be used as many times as needed. RESTful routing is the current standard for routing in Rails, so please try to utilize this format when creating future products. Predictability makes coding easier, and makes the user experience more friendly. Thank you for reading. Be sure to checkout my blog on more RESTful routes here!

HAPPY CODING!