From the course: Databases for Node.js Developers

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Item administration: Create, update, and delete

Item administration: Create, update, and delete - Node.js Tutorial

From the course: Databases for Node.js Developers

Item administration: Create, update, and delete

- [Instructor] In the previous video, we connected our admin page to MongoDB to list all items and to load an item for editing. Now it's time to complete CRUD by creating, updating and deleting items in the database. After this video we'll have a fully functional admin panel where we can add new items, modify existing ones, and remove item from our database. Let's get started. We already have a form in our admin panel, but right now submitting it doesn't actually update the database. So let's update our route to either create a new item or update an existing one based on whether an item ID is provided. This is a very common pattern for database manipulation routes. So let's look into this in Visual Studio Code. And when I scroll down, here is this route. So it's a post route because we are submitting a form. And in line 15 we get the itemID, the sku, the name, and the price. And also what I not have here, please follow along. We also want to get the tags here. So also let's close this…

Contents