CRUD API Tutorial – Node, Express, MongoDB

**Adding Juice to the API**

I can see that juice is added. I mean nothing happened. It's everything is working okay, so if if juice is added, can we view all these? Then just copy this and you could actually view it in their browser as well. So if you do this, you could see that all these lists are working. I mean it didn't basically impact the API performance of pancake doughnut cheesecake chocolate and juice have all been there. Nothing is being broken and nothing seems to break everything seems to work. You could see if I want to um add uh this is the ad so get API so if I just send you can see now all of these things are being populated here. If you want to you know delete anything suppose I don't really want you know cheesecake. I could just get this ID first of all let's copy this and we can actually update the ID as well right now try to update Pizza it's not going to allow you because uh it can't find it 404 right. We could put a really good message over there and that's something that I want you to put a message using you know response but right now you can see that this is the now I changed it to the updated uh so cheesecake so cheese I'll just write it and then the price and then I press okay. So now over here we have slash API products now this is important now whenever when I you know I did the organized way to do the route and controller I changed all of them from now so everything has Now a/ API SL products now if I do this you can see that the cheesecake has been updated and you could view this uh cheesecake by using get API and this would uh basically send it and you could see over here pancake donut updated cheese okay and then we have chocolate. If you want to delete the cheesecake uh you could just have this you know from here with the ID passed in but again the product will be changed to products and this is the delete method. Now if I press send you can see product deleted successfully and if I want to review all the products so I'll do here and I press send again and you can see pancake donut chocolate and juice.

**Adding Code to GitHub**

One final thing I wanted to do was to add this into GitHub so this code that I added I wanted all of this to be populated on GitHub. So what we could do is we could go to github.com so what we could do is essentially I'll go to my GitHub account so and then over here we have this plus button and create a repository and we'll you know we'll call it simple uh so we'll say simple crud app and we'll say backend okay and then over here we'll have it public. We'll create repository and then over here we could just initialize using this command. Make sure you have that so what you could do is this is the uh directory here you could just go and do CMD this opens up the command prompt you could have the following uh commands typed so first of First Command is I would uh you know I'll just turn off this because we don't need this for now. And now what we're going to do is we could just go here and uh first man so we could go here okay and what we could do first is we could have git in it which is initializing the git um and then after that we have get add all the files so we just say get add everything okay now I didn't have to do slash but dot okay. So this means I added everything then after I do get commit i m and I say first commit all right so you could just do any message you want I just did okay now after that we want get Branch hyphen M and then hyphen M and then we have main branch okay so now this is on the main branch. Then I want to get remote uh add origin and I have to put in the URL of that repo so basically just copy this uh and you have to put it in the URL path here so right there so get remote add origin and then once you have everything finalized you just do get push hen new origin and then main if you do this and press enter this would update this on GitHub so now you could see that everything is on GitHub which is great. And you could see one other thing that node modules isn't existing here and the reason why I did that was because I put it in this uh you know get ignore and you can see that get ignore didn't include the node modules which is pretty heavy and bulky and you don't want that and you could also put in your you know EnV variables your credentials and all these stuff we could go in the uhv file and then you could put in the EnV in the. Ignore so yeah these are the things um and precautions I'll put this link into the uh description so thank you so much for watching