What are REST, Routes, CRUD?
Representation State Transfer or REST is a pattern/convention for defining our routes. Routes are the code that listens and receives requests then figures out what to send back. CRUD stands for Create, Read, Update, and Delete. These are the 4 basic functions we have when building an API.
So why do we want any of this? Mostly it’s just about keeping things simple and repeatable when building apps. By following a convention we don’t have to reinvent the wheel every time we make an app and other developers will quickly figure out what’s going on.
The Magnificent 7
REST is made up of 7 standard routes:
|Displays a list of all teams
|Displays a new team form
|Adds new team to the database then redirects
|Shows a particular team
|Shows an edit form for a particular team
|Updates a particular team in the database then redirects
|Removes a particular team from the database then redirects