loading...

Build your first RESTful API with Node.js and Express. CRUD Operation with API in Node.js and Express

jalpeshvadgama profile image jalpesh Vadgama ・3 min read

I have created a video series where I have explained how we can create RESTFUL API with node.js and Express. It is a four-part video series and each part explains one operation in the details.

Part 1: Build your first RESTful API with Node.js and Express Get all students and Get Students by Id:

In this video, I have explained how we are creating A get APIs to get all the data from the data store. In this video, I have not used any database but I have used object array as a database. So in this first part, I have explained how we setup the express and express router to map functions against the URLs(Endpoints) of Web API. Then I have created two APIs 1) Get all students 2) Get Students by Id and I have also explained how it is done via code.

Following is the first video of the comeplete video series:

Part 2: Build your first RESTful API with Node.js and Express Create Student(Post):

In this part, I have explained how we can use Body parser a middleware to get data from the request body. Basically body parse is a middleware that extracts body from request and provides us in east format. Then I have explained how we can get data via POST API and get data from the request body. After that, I have created the 'ValidateStudent' function to demonstrate how we can validate the data coming from our body.

Following is the second video of complete video series:

Part3: Build your first RESTful API with Node.js and Express Update(Put):

In this video, We have created a put API with the help of express and node.js. Here we are passing two things there. One is Id on which we need to update Student and Student Object which we want to update. In API I am checking whether our student's array is having that Id or not
otherwise it will return not found. If it is there then it's going to first validate student object and then update it with new data.

Following is the third video of the complete video series.

Part 4: Build your first RESTful API with Node.js and Express Delete

In this video, We have created a Delete API with the help of express and node.js. Here we are passing id for a student whom we need to delete. Then we are checking if a student with that student id exist then we are deleting that students from the array which act as our database. And the end we are sending the message that the student deleted successfully.

Following is the fourth video of the complete video series.

All the Source Code for this video series is available on - https://github.com/JalpeshVadgama/FirstNodeJSRestAPI

Subscribe to my channel:

As you know there is lots of hard work required to create a video series like this. So If you like this video series and wanted to see a similar kind of videos then, please subscribe to my youtube channel at

https://bit.ly/codewithjv.

It gives me the inspiration to create more video series like this. Also, please share your thought on the content you wanted to see on my youtube channel. I will try to create content based on popular demand. So please let me know and I will try to cover topics mentioned in the comments.

Also, Do let me know what more content you wanted to see in for node.js.

Posted on by:

jalpeshvadgama profile

jalpesh Vadgama

@jalpeshvadgama

Full Stack Developer, Blogger, Microsoft Mvp, Mentor, Lifelong learner, 14 Years of Experience in JavaScript, web and Microsoft technologies. ASP.NET MVC/Core, C#, Angular,Vue.js, and node.js

Discussion

markdown guide