Press "Enter" to skip to content

REST – RESTful routes table

In the Web Developer Bootcamp course by Colt Steele a chart for RESTful routes is referenced for whenever you want to map HTTP routes to CRUD (Create, Read, Update, and Delete data) operations. Using REST (Representational State Transfer) ensures understandability and uniformity of your CRUD app. In the context of web development, REST refers to a set of guidelines for HTTP verb and URL combinations and their designated actions.

Name Path HTTP Verb Purpose Mongoose Method
Index /dogs GET List all dogs Dog.find()
New /dogs/new GET Show new dog form N/A
Create /dogs POST Create a new dog, then redirect somewhere Dog.create()
Show /dogs/:id GET Show info about one specific dog Dog.findById()
Edit /dogs/:id/edit GET Show edit form for one dog Dog.findById()
Update /dogs/:id PUT Update particular dog, then redirect somewhere Dog.findByIdAndUpdate()
Destroy /dogs/:id DELETE Delete a particular dog, then redirect somewhere Dog.findByIdAndRemove()

You can find the course on Udemy. It’s a great introduction to Node,js Express and MongoDB.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *