From the course: Vue.js: Creating and Hosting a Full-Stack Site

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Deleting server data

Deleting server data

- [Narrator] All right, so now that we have this new endpoint for adding items to the user's cart, the next thing that we're going to do is add the endpoint for removing items from the user's cart. So what this is going to look like is we're going to add another endpoint and this is actually going to be a delete endpoint. So we had a get endpoint for loading the cart up here, we had a post endpoint for adding items to the cart, and we're going to have a delete endpoint which is just another request type for removing items from the cart. All right, and the actual path for this endpoint is going to be /cart and then it's going to include a request parameter, which will include the ID of the product we want to remove from the cart. So that's what the path is going to look like. It's going to be /cart/productid. And now for the callback, which again is going to have request and response object arguments, what we're going to…

Contents