Vanilla Node.js REST API | No Framework

  Рет қаралды 161,867

Traversy Media

Traversy Media

Күн бұрын

Let's create a REST API using Node.js only, without Express
Code:
github.com/bradtraversy/vanil...
💖 Support The Channel!
/ traversymedia
Website & Brad Traversy Udemy Course Links:
www.traversymedia.com
Follow Traversy Media:
/ traversymedia
/ traversymedia
/ traversymedia
Timestamps:
0:00 - Intro
2:03 - Getting Started
3:06 - HTTP Create Server
5:27 - Send a Simple Response
10:43 - Simple Routing
13:17 - Create The Model & Controller
14:45 - Get All Products
19:35 - Get Product By ID
27:15 - Create Product
39:17 - Getting Body Data
48:38 - Updating Products
56:36 - Deleting Products

Пікірлер: 320
@TraversyMedia
@TraversyMedia 3 жыл бұрын
I realized I have never done this. In an actual project, you would most likely use Express or some other framework, but I wanted to do this for learning purposes so you can see a bit of what goes on under the hood. This API can be improved (eg. creating a better router), so feel free to work on it and make a PR :) Hope you enjoy!
@ammarrazzak5302
@ammarrazzak5302 3 жыл бұрын
I agree, creators like you will ensure that people learn the basics before moving on to the top layer and forgetting what was underneath all of it. I always schedule a coding session for myself of creating a mini express type clone with 'http" module, but never got to it. Thanks for the incredible content! Take care!
@codingman313
@codingman313 3 жыл бұрын
How is ur health now sir. In last few years i learnt a lot about web programming from ur channel. Thanks a lot for your sincere efforts for all these years helping numerous newcomers and students. I really felt bad when i found that your health was in bad condition. Seeing you active again really made me happy. Once again thank u so much from the bottom of my heart.
@cwinter90
@cwinter90 3 жыл бұрын
I actually was contacted by a company yesterday that was looking for someone with Node.js server experience. Told them I've used Express and NestJS figuring they were being generic. Nope... they legitimately use raw Node.js for their backend. Not interested in making things more difficult for myself lol.
@tomhames6884
@tomhames6884 3 жыл бұрын
Completely agree. Frameworks purposely abstract a lot of the details, but for beginners, and in general, it's really important to understand what's going on under the hood. Hope you're well, Brad.
@TraversyMedia
@TraversyMedia 3 жыл бұрын
@@codingman313 It is better. Still having the same issues, but I am on a new med that is helping. I will do an update on that soon :)
@codewithgedo3067
@codewithgedo3067 3 жыл бұрын
Your voice make me comfortable, and motivate me to listen to you even if I wouldn't 😂😂
@TraversyMedia
@TraversyMedia 3 жыл бұрын
Thanks :)
@rranga99
@rranga99 3 жыл бұрын
Actually you make me feel that there is still more I can do. Thanks for all your contributions and support.
@kevalkaria
@kevalkaria 3 жыл бұрын
Yes really
@consoledoterror971
@consoledoterror971 3 жыл бұрын
Yeah, You are right.
@abdullahalakus9700
@abdullahalakus9700 3 жыл бұрын
yeah me to
@AbhaySharma-lf1cv
@AbhaySharma-lf1cv 3 жыл бұрын
Finally, The OG BRAD himself
@eleah2665
@eleah2665 3 жыл бұрын
the KING is here today.
@FatherOfTheParty
@FatherOfTheParty 3 жыл бұрын
This was very instructive and well done. Thank you for taking the time to put this together! Going in I knew no NodeJS at all. Still far from fluent but I am now comfortable with the basics and can easily build on what you've taught me. Thanks again!
@arkhamian7586
@arkhamian7586 3 жыл бұрын
You undoubtedly know how to push your audience towards developing real coding skills. Thank you in advance for all the hard work.
@victorlima4801
@victorlima4801 3 жыл бұрын
A few days ago I decided to start making a mini express clone for self challenge and learning purposes, and now I found this. Your tutorial is extremely helpful, thanks a lot!
@thesteppino45
@thesteppino45 3 жыл бұрын
Welcome back, Brad. You sealed the choice for me when I was trying to choose between starting web development and app development. Thanks.
@denissanchezleyva8954
@denissanchezleyva8954 3 жыл бұрын
Hey Brad, you are like the Ave Fenix , after 30 days of break. Now, the contents is very high level. I am still in the last sections of your Mer-Ecommerce course after 3 weeks studying 2 hours per days. It is awesome. I recommend it 100%. And now this one. Man, you have a special skill to write code. It is like poetry for those who love coding. No doubt. God Bless you.
@abdullahalakus9700
@abdullahalakus9700 3 жыл бұрын
brad, you are the person who made me love the code, I can't thank you enough
@peterluke9392
@peterluke9392 3 жыл бұрын
After watching your channel for a year or so, I decided to buy your js course. Worth every penny of it you helped me a ton.
@mysterOrel7924
@mysterOrel7924 3 жыл бұрын
Already know all this but it's a good habit of mine to come back and watch tutos of things that i already know... sometimes you find yourself lreaning new things that you missed or forgot ! Thx Brad and happy to have you again !!!!
@tblancog
@tblancog 3 жыл бұрын
The most difficult part was to set the post data but certainly, all this makes you understand what's under the hood of a framework. Great tutorial, I enjoyed every minute.
@jordansumitomo2357
@jordansumitomo2357 3 жыл бұрын
Purchased your MERN ecommerce course learned a lot from you thank you keep making courses.
@vinukapussepitiya3939
@vinukapussepitiya3939 3 жыл бұрын
Where is the course
@jordansumitomo2357
@jordansumitomo2357 3 жыл бұрын
@@vinukapussepitiya3939 www.udemy.com/course/mern-ecommerce/
@dw.beastma9182
@dw.beastma9182 3 жыл бұрын
I just learned about fetching API today and now you posted about REST API using Node.js only!!!! Thanks for always sharing Brad, I bought your new course the day it's started being sold though haven't started learning it yet since I believe I should focus more on my foundation before tackling all the trending framework.
@Pareshbpatel
@Pareshbpatel 3 жыл бұрын
Some serious learning that most newbies would not have bothered to learn. Thank you very much, Brad. [PBP 2021-05-25 20:48]
@austinwheelo
@austinwheelo 3 жыл бұрын
With all due respect and props to your contributors, they did an excellent job, it is great to see you back! I hope you are doing well and feeling good! Pace yourself, we've all been there.
@shaunr9088
@shaunr9088 3 жыл бұрын
List not only helped me understand REST better but Node JS in general. Thank you.
@vinubox
@vinubox 3 жыл бұрын
Ah! That soothing sound of information is a back, welcome back with all my heart...
@biswayannandi6136
@biswayannandi6136 2 жыл бұрын
There are many videos and blogs with titles 'REST API using NODE' and each one them are using Express. I wanted to learn how can I do it using Node only and I got this...Great work💕❤
@hsvt12
@hsvt12 3 жыл бұрын
this is amaing I love when people do videos which don't use libaries really shows the inner working of how the libary works
@_rachid
@_rachid 3 жыл бұрын
I loved this course, thank you Brad!
@fluntimes
@fluntimes 3 жыл бұрын
I have wanted to see this for a while just to be "in the know". I am doing your API Masterclass on Udemy and this tutorial outlines how cool Express is for handling all the moving parts of an API. Awesome!
@Mescudi94
@Mescudi94 Жыл бұрын
One of the best tutorial I have seen, thank you for this. Plus, you have a way to speak which is very comprehensible for non-english people like me, I'm quite amazed to understand very well each word !
@nishantkumar6960
@nishantkumar6960 3 жыл бұрын
I work listening to Brad's voice and I sleep listening to Brad's voice 😁 It keeps me calm. It's Brad 24*7✌️
@tobiasjennerjahn8659
@tobiasjennerjahn8659 3 жыл бұрын
Hopefully this video means you‘re doing well. Or at least a little better than before. Thanks for all the amazing content you put out.
@CreativeJE
@CreativeJE 3 жыл бұрын
its so good to hear your voice brad I was really missing it :(
@stuartmarsh5574
@stuartmarsh5574 2 жыл бұрын
Thank you, great video. It took me forever to realize that my delete response body wasn't showing up because I used a 204 response code. I like the idea of using a 200 and being able to confirm the deletion.
@sirojxujamuminkhodjaev1369
@sirojxujamuminkhodjaev1369 3 жыл бұрын
I entered the web development world with your help Brad. Nice to hear you again bro.
@jfbiswajit
@jfbiswajit 3 жыл бұрын
love to hear your voice after the intro. ah, peace! honestly, I can't tolerate anyone else voice after the intro. love you Brad! ❤
@jaychandran24
@jaychandran24 3 жыл бұрын
The MERN course is dope! Thanks, Brad!
@icaras12x87
@icaras12x87 3 жыл бұрын
Is it Brad? omg that's an honor. We subscribed because of you, Brad, never forget this
@LongBoy.0
@LongBoy.0 3 жыл бұрын
Brad, the MVP of software engineering out here doing on youtube what most $20,000 bootcamps claim to do, but fail at. Thanks so much Brad.
@cervantes01
@cervantes01 3 жыл бұрын
hi Brad, I've really been enjoying your guest contributors, but it is great that you can still post the occasional video. Well done:)
@amarjitkumarsingh25
@amarjitkumarsingh25 3 жыл бұрын
Thanks Brad, it was a good learning curve. Enjoyed! Thanks for your time.
@jamjam3448
@jamjam3448 2 жыл бұрын
Thanks so much! I learned how the matching of the params work without expressjs
@emanueltejadacoste2250
@emanueltejadacoste2250 3 жыл бұрын
Amazing video, now i can move on to the node js complete course. you are a TITAN
@latinrev3822
@latinrev3822 3 жыл бұрын
Really interesting seeing how the req.body works under the hood, really cool Brad!
@maxprofitonemilliongoal2184
@maxprofitonemilliongoal2184 3 жыл бұрын
7:50 BIG WIN 2020 kzfaq.info/get/bejne/es17a6-Alqvdh5s.html
@jaleotech5918
@jaleotech5918 3 жыл бұрын
Nice to have you back....thanks for the video
@darint07
@darint07 3 жыл бұрын
I was looking exactly for this. Thank you!
@rustatum2382
@rustatum2382 3 жыл бұрын
I found that uuid() would occasionally create an id number that begins with a letter instead of a number. It helps to replace the '[0-9]' with '[a-z0-9]' in the three url.match conditionals in the server component
@BigBaddaBoom
@BigBaddaBoom 2 жыл бұрын
Not all heroes wear capes, @RusTatum. Thank you. Unless, of course, maybe you are wearing a cape? I was troubleshooting why some uuids were breaking the getById function. If I could pin your comment to the top to help others, I would. I was receiving the response from the server of "Route Not Found" for UUIDs like: c69c7182-4a6d-4b78-aa03-e0db92cfe371 Since this UUID started with a letter, everything broke.
@mrjeter
@mrjeter 3 жыл бұрын
What a wonderful class, thanks Brad!
@stevenwinsir6229
@stevenwinsir6229 3 жыл бұрын
very helpful video, i always use koa framework and almost forget these basic node js. it seems like I need to review again
@user-ky7hv2mr7h
@user-ky7hv2mr7h Жыл бұрын
Incredible quality video! Good voice record and nice material! Thank you very much!
@Muaddibkhan
@Muaddibkhan 3 жыл бұрын
Great to see you brad back to your routine
@erikshumkov4848
@erikshumkov4848 3 жыл бұрын
Good to have you back again, hope you are doing well. :)
@KostasOreopoulos
@KostasOreopoulos 3 жыл бұрын
First of all, great video as always. A "quick" remark The View in MVC in the backend is not the "View - Presentation" of the results in your browser. View in MVC is the presentation of the Data to the outside world. In this case, the View is a Data-Mapper. You get data from the Database and create a "view" to send back. For example, you could create another View for a normal user (less data) and an admin (all data), or an authorized user (some data depending on authorization). Technically, not in this example, of course, The Model, should consist of a Service and a DAO (data access object). The controller gets the incoming data from the body and does validation of data and then "asks" the corresponding Service to do the task. The Service will reach out to different services (if needed, for example checking authorization, cache, external APIs, etc), prepare all the information, and then asks the DAO to get the data DAO is the data abstraction. For example, products could read data from JSON, XML, mongo, Postgres. DAO should be unified access. Let's say getProduct(id,'json'), if you want to define the source, but you could omit that. Just do getProduct(id), but hide which DB you are using. If you later want to change DB, you would just change the implementation of that function. A nice library doing that, which seems promising is prisma.io (currently only supporting SQL databases)
@SteveCarroll2011
@SteveCarroll2011 3 жыл бұрын
As someone that prefers minimal code when possible, this is most appreciated! The pacing is excellent, the sequence of how you put this together is, as well. No wasted time. It looks like you just turned on screencast recording and ‘winged’ it, is that the case?
@Judas_Is_Fish
@Judas_Is_Fish 3 жыл бұрын
You can't even imagine, how long I was waiting for this kind of video with vanilla Node.js. Thanks a lot, you make world a bit better :)
@Tim12x
@Tim12x 3 жыл бұрын
только вот для чего ты это ждал?
@Judas_Is_Fish
@Judas_Is_Fish 3 жыл бұрын
@@Tim12x Потому что мне грусто от того, что такие элементарные вещи, как обработка POST запроса, объясняют только на нагроможденном Express, а про ванильную ноду дальше запуска сервера почти никто ничего не объясняет
@Pareshbpatel
@Pareshbpatel 2 жыл бұрын
Completed excellent tutorial on CRUD API in Vanilla JS. Thanks, again, Brad {2021-12-16}
@tarunkishore4574
@tarunkishore4574 3 жыл бұрын
Man ! U always come to the rescue when i need something so badly !!
@tarunkishore4574
@tarunkishore4574 3 жыл бұрын
@Jack Saat I needed it to understand node completely. And currently facing some issues with express
@excalibur885
@excalibur885 3 жыл бұрын
Best content on the internet xo happy that this channel exists. Ty Brad
@eyuelbegashaw8609
@eyuelbegashaw8609 3 жыл бұрын
please do more projects with pure NodeJS , no framework. there is literally nothing online except express. frameworks will change from time to time. we
@danilx6239
@danilx6239 4 ай бұрын
true
@music-unleashed
@music-unleashed 3 жыл бұрын
I made API-s with PHP since the beginning of times but man... this was soo sweet. I have to mastering this stuff and search a new job :)
@CodestarTechnologies
@CodestarTechnologies 3 жыл бұрын
This is what I was waiting for thanks brad
@nested9301
@nested9301 2 жыл бұрын
i just complete all of this and i"m proud of my self xD thank you!
@user-ru2jb4yo3s
@user-ru2jb4yo3s 11 ай бұрын
thank u sooooo much really worth and i made it with u step by step , it's fully functional at me
@lardosian
@lardosian 3 жыл бұрын
Thanks Brad, just watched an interesting video about serverless applications. Would love to hear your take on the serverless approach.
@Saiphes
@Saiphes 3 жыл бұрын
YAY, I was your 3000th like for this video! :P
@cookiesndata211
@cookiesndata211 2 жыл бұрын
I enjoyed it ,thanks . Keep up great work. Have a Happy New year .
@chukwumaobi7770
@chukwumaobi7770 3 жыл бұрын
Welcome back. we missed you!
@hamzaazr8181
@hamzaazr8181 3 жыл бұрын
listening to this voice made my day
@Jet1323
@Jet1323 3 жыл бұрын
daim i love this video :O was about to look it up and there you were haha!!
@chinmayghule8272
@chinmayghule8272 Жыл бұрын
I followed through the entire course except for one thing. I used a regular array instead of a json file since I was using an old file from a previous tutorial. Because of this every time the server restarts all the changes made in the server got overridden and I had to start over again. Nice course, this really makes me appreciate Express.js.
@88noname88
@88noname88 3 жыл бұрын
I'm so happy that we have frameworks like Express. It is makes our life easier
@regal_7877
@regal_7877 3 жыл бұрын
I've just got into backend web development (I'm an extreme newbie) and I've been searching to hell and back for this specific topic to no avail. I did a lot of reading and didn't want to learn a new language like Ruby and then Rails so this is such a blessing I can't even begin to describe. Thank you.
@BillClinton228
@BillClinton228 3 жыл бұрын
There are many ways to do backend work, Node is not the be all and end all just because all the "cool kids" are using it these days, 8 years ago Ruby was the in thing and all the hipster programmers couldnt shut up about it. Don't follow fads, try out different languages and use which ever language you feel most comfortable with, and if you think this tech will get you the most money remember this is the tech industry and fads change very quickly.
@regal_7877
@regal_7877 3 жыл бұрын
@@BillClinton228 Yeah definitely. I'm not one to get sucked into trends and stuff. I actually started off with C/C++ believe it or not, and I'm not even from a Computer Software background, I do Electronics. I'm still extremely inferior in those languages too but since then I've already tried python, java, html/css (not programming but close enough) and javascript. I just thought it would be easier to use Node.js since I've done some work with Node before. Although I do have a hard time wrapping my head around the "async-await-sync" stuff. I was actually already starting to learn Ruby but....time
@jakegerard1870
@jakegerard1870 3 жыл бұрын
Awesome stuff Brad!
@sebastiancastillo3560
@sebastiancastillo3560 3 жыл бұрын
Yes !, finally our savior is back. Thank you Brad !, I hope you're great.
@FabioGiacomini
@FabioGiacomini 8 ай бұрын
Awesome video, very well explained. Thank you
@maciekjedlinski1832
@maciekjedlinski1832 3 жыл бұрын
Just when I needed such video!
@KaranveerSingh97
@KaranveerSingh97 2 жыл бұрын
Nice video. To get params from urls, an easier way is to use the in-built url package in node.js
@pratikxavier8176
@pratikxavier8176 3 жыл бұрын
After working with express for a while now I was still confused what's really happening under the hood. God bless you Brad🙂👍 #respect Love from India🙏
@eajajulratan2004
@eajajulratan2004 3 жыл бұрын
Thanks man! Good to see you!
@akramnarejo6221
@akramnarejo6221 Жыл бұрын
thanks for creating a beautiful content. and I happy to let you know that I completed it.
@NeverCodeAlone
@NeverCodeAlone 3 жыл бұрын
Thx for this nice video. It brings me a lot because it is real know how and not only a framework configuration ;)
@sakamoto399
@sakamoto399 3 жыл бұрын
glad to see you back.
@joshuataruc2385
@joshuataruc2385 3 жыл бұрын
Hi Brad Ive learned a lot from you this past 4years ive been watching your tutorials, will you please make a crash course of laravel 8 that will be much appreciated
@DrLouellLSala
@DrLouellLSala 3 жыл бұрын
I've been looking for this topic
@rajsuthanofficial7585
@rajsuthanofficial7585 3 жыл бұрын
Hey Traversy, i don't know whether this a co-incident, but I did the exact same thing today for practice & wondered to make a video on this
@justkitob
@justkitob 3 жыл бұрын
Yeah I hope come back Brad . the best tutor
@mackynikat8833
@mackynikat8833 3 жыл бұрын
. done with this . im only stuck with rest client but everything seems fine now . good luck adopting new era sir ( not on new normal )
@ThePurpleMaestro
@ThePurpleMaestro 3 жыл бұрын
i see video i hear brad's video i press like
@the_full_stack_junkie
@the_full_stack_junkie 3 жыл бұрын
Thanks Brad always a winner ! 🤓
@maxd7228
@maxd7228 3 жыл бұрын
Ahhhh. The soothing sound of Brad’s keyboard.
@mekdadmoussa7528
@mekdadmoussa7528 3 жыл бұрын
Thank you bro, Wish you all the best..🙏
@laikesagores3258
@laikesagores3258 2 жыл бұрын
Great video, very helpfull, understanding. Thank you!!!
@vishnujr1130
@vishnujr1130 3 жыл бұрын
Finished your MERN Ecommerce udemy course..it was a wonderful experience..learned a lot
@TraversyMedia
@TraversyMedia 3 жыл бұрын
Wow, that's impressive that you already finished it. It takes me a month to finish a 15 hour course lol
@ammarrazzak5302
@ammarrazzak5302 3 жыл бұрын
@@TraversyMedia Lol! Still working on the Modern JS course, has been over 1 year. Now it acts as a recipe book. But it helped me alot when I was struggling with JS.
@vishnujr1130
@vishnujr1130 3 жыл бұрын
@@TraversyMedia Thanks Brad. You did all the hardwork to get things easy for us. That's why I could finish the course much quicker. Your way of implementing redux in that course was impressive to me as a beginner. Thank you for all the hardwork and support.
@raiyanthedeveloper
@raiyanthedeveloper Жыл бұрын
Thank u so much for making this video.
@radu9150
@radu9150 3 жыл бұрын
Thank you, Brad!
@jlambert12013
@jlambert12013 2 жыл бұрын
When Brad said “ it’s a pain in the ass (but) I like doing this kind of stuff” .. I felt that. @12:40
@MizanurRahmannickty
@MizanurRahmannickty 3 жыл бұрын
Thanks, Learned something new
@pileydes
@pileydes Жыл бұрын
Thank you very much, really much appreciated.
@jemjem8902
@jemjem8902 3 жыл бұрын
How are you doin Brad? So happy seeing you again!
@saleumsack5280
@saleumsack5280 3 жыл бұрын
Thank you so much brad,
@prateekmitra9702
@prateekmitra9702 3 жыл бұрын
So that's what happens BTS Express.js. Really good explanation, given I am a newbie in backend.
@houseofcoding101
@houseofcoding101 3 жыл бұрын
Thnx brad for awesome tut
@melfordbirakor
@melfordbirakor 3 жыл бұрын
Wow... Awesome!!! 💥💥💥 Thanks Boss
@user-dx6we1pn6q
@user-dx6we1pn6q 3 жыл бұрын
I am a simple man. I hear Brad, I hit like
@a.osethkin55
@a.osethkin55 3 жыл бұрын
Thanks for video!
@CrookzArtwork
@CrookzArtwork 3 жыл бұрын
Thanks for this one !!
@laikesagores3258
@laikesagores3258 2 жыл бұрын
Amazing video!!! Thank's a lot...
HTMX Crash Course | Dynamic Pages Without Writing Any JavaScript
56:47
Traversy Media
Рет қаралды 142 М.
Can A Seed Grow In Your Nose? 🤔
00:33
Zack D. Films
Рет қаралды 23 МЛН
Stay on your way 🛤️✨
00:34
A4
Рет қаралды 24 МЛН
Сервер на Node.js от простого к сложному. Исчерпывающее руководство
1:20:29
WebDev с нуля. Канал Алекса Лущенко
Рет қаралды 18 М.
Good APIs Vs Bad APIs: 7 Tips for API Design
5:48
ByteByteGo
Рет қаралды 225 М.
HTTP сервер на Node.js (routing, cluster, IP sticky)
1:08:57
Timur Shemsedinov
Рет қаралды 16 М.
Node.js Crash Course
2:06:35
Traversy Media
Рет қаралды 136 М.
What Is A RESTful API? Explanation of REST & HTTP
18:38
Traversy Media
Рет қаралды 1,4 МЛН
Build an API Proxy Server - Hide Your API Keys, Rate Limiting & Caching
32:20
How to build a REST API with Node js & Express
58:40
Programming with Mosh
Рет қаралды 1,7 МЛН
The Importance of Specialization in Coding
7:13
Traversy Media
Рет қаралды 210 М.
I Stopped Using Express.js: Because Bun and Hono 🔥
10:23
Sam Meech-Ward
Рет қаралды 110 М.
Todos os modelos de smartphone
0:20
Spider Slack
Рет қаралды 64 МЛН
iPhone socket cleaning #Fixit
0:30
Tamar DB (mt)
Рет қаралды 18 МЛН
İĞNE İLE TELEFON TEMİZLEMEK!🤯
0:17
Safak Novruz
Рет қаралды 1,7 МЛН
#samsung #retrophone #nostalgia #x100
0:14
mobijunk
Рет қаралды 13 МЛН