From the course: Building RESTful APIs with Node.js and Express

Unlock this course with a free trial

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

Create POST endpoint

Create POST endpoint

- [Instructor] This video, we'll complete our post endpoint so we can add new items to our database and then test it. So let's get to it. So the first thing we're going to do is go into our CRM controllers. So we don't need the model anymore, so we're going to close it. And then go into our controllers. So we're going to start working in here cause this is what is going to basically be the functions that will send the data to the database or update the data and so on and so forth. And then use the endpoint as the kind of portal to all of this. So let's go ahead and start with what we need. Import mongoose from mongoose. And then we're going to import our schema, which we've worked on. Contact schema. And if you want a little tip when you're working with the imports, you can always do import from. And then let's go and grab what we need. From models, CR model. But let's say for example, you did all this already…

Contents