Knew most of this, but I still watched the entire tutorial because it was so incredibly well structured and didactic. You are a born teacher. I've often fantasized about making great and clear youtube tutorials, in my wildest most perfect fantasies, they looked exactly like the stuff you actually make! Incredible!
@thomaskoenig21022 жыл бұрын
I agree. Really entertaining videos
@mauronapsuciale37204 жыл бұрын
This is the clearest, most elegant tutorial of Express JS basics. Amazing since it was uploaded two years ago. Thanks, Mosh.
@chamcham2123 жыл бұрын
Agreed!!
@Dcooper6762 жыл бұрын
Ya but advance topics r wery little
@YoussefZidan4 жыл бұрын
I've been learning web development for over a year, and I've never seen such amazing, organized, coherent courses like yours! Thanks Mosh!
@RaksSharkiJa1 Жыл бұрын
so true
@rashi1662 Жыл бұрын
19:14 below commands for windows, these are case sensitive so use exact VARIABLE name For Command Prompt: set PORT=5000 For Power Shell: $env:port=5000 For Bash (Windows): export PORT=5000
@w4.k2 ай бұрын
Thanks!
@venkataramanagovindu52445 жыл бұрын
00:49 What are RESTful APIs 06:48 Introducing Express 09:09 Your First Web Server 14:57 Nodemon 16:29 Environment Variables 19:44 Route Parameters 25:22 Handling HTTP GET Requests 30:09 Handling HTTP POST Requests 33:53 Calling APIs using Postman 36:03 Input Validation 44:03 Handling HTTP PUT Requests 52:33 Handling HTTP DELETE Requests
@tekz5412 жыл бұрын
thank you so much
@r_lonef2 жыл бұрын
@@tekz541 you blind this is in the description
@tekz5412 жыл бұрын
@@r_lonef ahhh, im was not reading the description
@r_lonef2 жыл бұрын
@@tekz541 programmers always should if they need something :)
@zamudpoe3 жыл бұрын
I appreciated a lot this free one hour tutorial, I already finish it and I bougth already right now!, I hope the full course is ok and updated!... If you guys want to learn dont hesitate ... watch this video of one hour and when you finish , you'll be more skilled than the before you watched this free course of one hour!.
@fitigued4 жыл бұрын
As Mosh wisely said to use that specific version of Joi it will work but note that in the current version of Joi you have to make the schema a Joi.object and then at 40:54 validate the schema rather than validate Joi e.g. schema.validate(req.body).
@allain58406 жыл бұрын
I've been a c# dev for about 7 years and wanted to learn new technologies like nodejs and this video is great to start with. Thanks Mosh
@nikki_ke_nuskhe3 жыл бұрын
41:17 from v17 of the joi package, here's the updated code of the post route const schema = Joi.object({ name: Joi.string().min(6).required() }); const result = schema.validate(req.body); console.log(result);
@ahartami10143 жыл бұрын
Hi, I am using Joi version 17 too. I have problem because Joi.validate or Joi.Object are not recognized functions. Could you help or explain a little bit more? function validateCourse(course){ const schema = Joi.Object({ name: Joi.string().min(3).required() }); return schema.validate(req.body); }
@ahartami10143 жыл бұрын
I have solved the problem. I have to use Joi.object and correct parameter. It is working now. Thank you. function validateCourse(course){ const schema = Joi.object({ name: Joi.string().min(3).required() }); return schema.validate(course); }
@audraogilvy26052 жыл бұрын
Thank you, Niharika!!!!
@baklangfrog77082 жыл бұрын
im not sure if i understood but can i just do validation from client side¿
@David-ik4mm3 жыл бұрын
You are the light of my life! You are a hidden diamond in youtube! I really don't know how a person could be so good at explaining things and make it accessible to all !! Thanks a lot for help.
@OvidiuPop702 жыл бұрын
If you meet the validation error, you have to do some changes to be according with your Joi version. With my Joi version: joi@17.6.0, the next changes worked: const schema = Joi.object({ name: Joi.string() .min(3) .max(30) .required() }); const result = schema.validate(req.body); console.log(result);
@golu46252 жыл бұрын
Thanks bro it really help.🙏
@MrBigHomieWithSomeCoolPants3 ай бұрын
You are my hero
@alansaldivares6 жыл бұрын
Man! this for far one of the best well explained Node+Express crash courses I've ever seen. You convinced me to buy the full series :)
@danyhan916 жыл бұрын
I was struggling learning how to create a server with node and express. This tutorial is really easy to understand and well-structured for beginners. This is so far the best tutorial on KZbin!!! Thank you so much, Mosh!!!
@xColdzero15 Жыл бұрын
This is my 3rd time watching a Mosh Tutorial Video starting from React, Node.js, to Express and it has really helped me in my career as an Application Developer. Thanks Mosh!
@kurisuta1305 Жыл бұрын
same... Mosh is so awesome!!!!
@greenie626 жыл бұрын
Very much dug and appreciated this tutorial. Where as a couple of others I 'learned' things, here I started to actually understand them. That's quite a bit more satisfying!
@lynndemarest19023 жыл бұрын
For those who missed it in the comment below, Joi has changed. This worked for me: const schema = Joi.object({ name: Joi.string().min(3).required() }); const result = schema.validate(req.body); console.log(result); if (result.error){ res.status(400).send(result.error) }
@mathewkempke45703 жыл бұрын
can we find a way to pin this to the top? I almost gave up because of this part
@shanthuog25893 жыл бұрын
if we install joi in the way it shows in the video. we wouldn't need this.
@mathewkempke45703 жыл бұрын
@@shanthuog2589 yea lets just not use the updated version of JOI makes sense
@emje68763 жыл бұрын
thanks for this .
@paraghbhide43614 жыл бұрын
I watched your entire Node.Js course which inspired me to change my profile from Angular to Node.js Developer. I have developed 2 apps with ionic/angular & node.js. Thanks to u I could be a full stack developer now.
@davenash15476 жыл бұрын
Mosh, your teaching style is so clear. Thank you for the courses!
@nopa30835 жыл бұрын
Mosh you are the man I learned this in my full-stack boot-camp, but didn't fully understand it. Your example was clear concise and helped me understand it better.
@MichaelRoberts-js6oy Жыл бұрын
At 41:00, if using Joi v17, Joi.validate() no longer works. Instead your schema object should be const schema = Joi.object({ name: Joi.string() }); Then use const result = schema.validate(req.body);
@usamashehzad59916 жыл бұрын
Hi Sir, i took your Angular course... and i made oshop till the end... from then i've been a great fan of you..... never seen such a great teacher.....!!!
@MaskuCreative3 жыл бұрын
Thank you .. You are the best tutor..... FYI , Joy Validate has made change in 2021, i use this code to resolve my problem of "Joi.validate is not a function". app.post('/api/courses', (req,res) => { const schema = Joi.object({ name: Joi.string().min(3).required() }); const result = schema.validate(req.body); console.log(result);
@m.aaqilawan4883 жыл бұрын
good friend
@maxmustsleep3 жыл бұрын
A few notes for everybody watching in 2021: // On windows you set environment variables like this: set "$Env:PORT = 5000" //(or maybe without the "" ) // Joi Validation method has changed! it's now like this: const schema = Joi.object({ name: Joi.string().min(3).required(), }); const result = schema.validate(req.body); console.log(result);
@Stafford-Shire3 жыл бұрын
You're a savior. Thanks!
@shivaniganji43003 жыл бұрын
For me, it's still listening to Port 3000... is there any other way to solve this?
@tochukwuchiguzorom79342 жыл бұрын
@@shivaniganji4300 Yeah, just set PORT=5000. don't put any space between the PORT, the equality sign and the 5000.
@dataSMASH4 жыл бұрын
Great tutorial. I had just finished the express course on codecademy and was still really confused. Watching this gave me a much better understanding and explanation of the why and how of building endpoints with express on your actual computer. I'll definitely be checking out your courses and your other videos.
@douglaswasswa71222 жыл бұрын
i just want to thank Mosh for that tutorial. i paid for your course and i'm here to say that it was not a mistake. thank you for your easy to understand courses. i appreciate you
@vaibhavshukla47616 жыл бұрын
Today was a lucky day I got the right tutorial on right time on KZbin
@namanrustagi5501 Жыл бұрын
Explained everything very beautifully ,simply,precisely. Wow!!!!!!!!!!!
@PrisantyaFridayana5 жыл бұрын
Thank you for your tutorial.. As a starter in Node, I found this really helpful Well structured explanation and good flow for a starter Now I could understand the basic of Node..
@dadonztobs5 жыл бұрын
I love his tutorials. If you are using a windows machine, dont use powershell when setting environment variables. rather use cmd because powershell doesnt update the variable until you restart the machine.
@shanes20076 жыл бұрын
Very good tutorial Mr. Mosh..Things are organised very well...Nothing is more or less..Good effort....Thank u...
@gerard027003 жыл бұрын
you are one of the best teachers i can absorb anything you teach so quickly in just one month i started to work on a big project (+10 k) with react/node + redux and mongoDB , thank you my master
@JoyAcharyatvl6 жыл бұрын
In one sentence , This lecture is awesome Mr. Mosh. thanks.
@NavinKumarmathur6 жыл бұрын
ur style of explaining things in this tutorial is very good. 👍 I'm lucky to watching this tutorial
@therealpunitdh3 жыл бұрын
I'm buying your full course after watching this. Legendary stuff.
@clementita543 жыл бұрын
00:00 - Intro 00:50 - Restful services 06:50 - Introducing Express 09:10 - Your First Web Server 14:58 - Nodemon 16:30 - Environment Variables 19:45 - Route Parameters 23:07 - autopromo 25:25 - Handling GET Requests 30:10 - Handling POST Requests 44:03 - Handling PUT Requests 52:36 - Handling DELETE Requests 55:25 - Fixing a bug 57:25 - Project
@clementita543 жыл бұрын
If you could add this to your description would be cool for new viewers :)
@0zniugnep904 Жыл бұрын
@@clementita54 bump
@yogeshbhatt3806 Жыл бұрын
First Time I am learning Node.js bcz I am Frontend Dev.. Its this video is quite easy to learn.. Thanx
@cellocarlos6 жыл бұрын
You should make a video teaching how to integrate nodejs and angular features. Your way to teach is unique!
@elvinjafarli62575 жыл бұрын
Thank you, paid university 50k, but still ran to KZbin for help. Thank you for your effort and time!
@elvinjafarli62575 жыл бұрын
@@programmingwithmosh Totally agree!
@erezta41556 жыл бұрын
Very professional teaching.. Moish, you are bomba.
@_.sunnyraj._4 жыл бұрын
*Mosh
@Manas-co8wl4 жыл бұрын
*Moisht
@awekeningbro12074 жыл бұрын
Moist
@technopeace40774 жыл бұрын
Momo
@gridgr1d2583 жыл бұрын
*Moishy
@user-zj9pq5xc7x4 ай бұрын
absolutely LOVED this short tutorial. learnt so much in just an hour. thank you!!!
@Kinos1415 жыл бұрын
This has to be the easiest tutorial on the subject. The others I've found do too much. Thank you, sir.
@vamshigudimalla10134 жыл бұрын
thankyou mosh , I have been watching API building videos but I had always stuck at routes topic but watching your video I not only have cleared my doubt but also acquired good knowledge
@maheshj015 жыл бұрын
Oh mosh this is a great tutorial the exact thing I WANTED TO learn,perfect for those who want to learn How backend stuffs work
@harishpaudel76704 жыл бұрын
How can I take course in udemy
@syedminhajhussain98934 жыл бұрын
@@harishpaudel7670 by spending money
@martind544 жыл бұрын
@@harishpaudel7670 my opinion would be to take Mosh's instead.
@eldikra3 жыл бұрын
Its a great course. I followed it and everything was fine except that when you delete 1 course, the length of the courses decrease. So when you try to add a course after that, it overlaps courses. Anyway, for learning it was excellent! I love it
@financeandforex2 жыл бұрын
It's scary seeing that someone knew about this four years ago
@aatiqaghazali78502 жыл бұрын
Same bro same
@obiabamba85292 жыл бұрын
This guy knew everything a long time ago, c++, c#, java, JavaScript, python, PHP et cetera. He knows everything in-depth, he is like a super tech master of all genius.
@ananyamahapatra6597 Жыл бұрын
🤣🤣🤣😂😂😂
@angryman9333 Жыл бұрын
Lmao,
@MedaGrande Жыл бұрын
😂😂😂
@kurisuta1305 Жыл бұрын
Thanks a lot! i finished ReactJs, NodeJs, and Express in two days! Thanks a lot
@vaibhavphutane2866 жыл бұрын
I bought your angular course on udemy and that was too good having right content in minimal time. This video about nodejs is awesome thanks mosh
@gennerawsama59553 жыл бұрын
for the people that tried Joi 16+ version here is now how to do it const schema = Joi.object({ name: Joi.string() .min(6) .required() }); const validation = schema.validate(req.body); res.send(validation);
@dhruvikdeveloper91084 жыл бұрын
all of your tutorials are awesome, easy to understand, interesting, and very helpful for a beginner student
@ProgramWithErik6 жыл бұрын
I bought your Angular course on Udemy and I saw you had a KZbin! Very cool!
@srjbora6 жыл бұрын
Program With Erik me too. 😁
@hardik.motwani5 жыл бұрын
How is it?
@preetishpatel230611 ай бұрын
If anyone reads this, please affirm my belief that the logic for post method should be updated now, after the delete method has been written. For eg after deleting the 1st course as mosh did in the lecture, if we call the post method with a valid body, we will create two courses with id = 3(since id of the new course is length of courses plus one). We can change the logic for Initialization of the new course id as the id of the last course object in courses plus one
@soumaghosh26715 жыл бұрын
Awesome tutorial MOSH! You made me feel at ease with learning new powerful frameworks which I was really scared of....thank you so much....
@codeconceptghana1544 Жыл бұрын
This course is still Gold I bet. Very valuable
@aaron10734 жыл бұрын
If anyone was struggle like I was since Joi has been deprecated here's my solution The way I got it to work was first const Joi = require('@hapi/joi'); The way I defined the schema was const schema = Joi.object({ name: Joi.string().min(3).required() }) The way I got it to validate const result = schema.validate(req.body)
@AlexBuaiscia4 жыл бұрын
thank you! I just had missed a little thing but I managed to make it work now :)
@subparmelon4 жыл бұрын
I stumbled across this. Can confirm this as working in version 17.1.0. I would highly recommend that if you are using VS Code make sure your intellisense is working. You will see that validate() takes two arguments *value: any* and an optional argument *options?: Joi.ValidationOptions*.
@anshulanand022 жыл бұрын
This was amazing, even after 4 yrs.
@drupalguy4 жыл бұрын
Thank you Mosh, this is a great tutorial; so many node concepts in one lesson and presented in a straightforward way.
@redph0nix6 жыл бұрын
This is THE cleanest api tutorial I have seen yet! It's just absolutely phenomial! Very well structured and easy to follow. Will be creating a basic orders api, and this will help!
@redph0nix6 жыл бұрын
Yes. I am going to purchase the course! :D
@mikek.27036 жыл бұрын
Massive thanks. This helped me a lot.
@Pareshbpatel3 жыл бұрын
A very clear tutorial on building APIs with Node and Express. The best tutorial on the subject. Thanks, Mosh {2021-08-14}, {2023-12-15}
@gerarldlee6 жыл бұрын
Hi Mosh, this is so great. You explain it in detail yet clearly understandable. Awesome.
@shaamidrees6036 Жыл бұрын
The way you explain theory is awesome we never get bored of it
@abhishekkumar-ih2ox6 жыл бұрын
such a great tutorial i had seen ever. Thanks for great organised and to the point video.
@codewithlakmal Жыл бұрын
Dear sir, thank you very much for your tutorial. You're great teacher!
@codingwalnuthindi69845 жыл бұрын
would recommend you to create a GitHub repository so that we don't have to pause the video to write code and run it every time.
@cayspruceway Жыл бұрын
Best investment I've made all year! Get the full course. Give this man his just due!
@edwardmarkovich19896 жыл бұрын
Excellent, thank you very Mosh.
@kevinveldman90816 жыл бұрын
I laughed out loud.
@zarnihein14584 жыл бұрын
The error I noticed in this code is ID setting for posting... When you delete ID:2 object, length of courses array is going to be 2. So when you post new object in this array, ID of new object will be 3 because of ID setting of post. In this case, there will be two objects having ID:3. I recommend below code to fix this error. const course={ id: parseInt(courses[courses.length-1].id) + 1, name: req.body.name }; Anyway, Thank you Mosh for this course. It's clear and I could catch all this up.
@mashoodshaukat19063 жыл бұрын
Thank you for rectifying
@Snitovets6 жыл бұрын
in powershell to set port variable: $env:PORT = 5000
@ezadviper6 жыл бұрын
Thanks man, what a savior ...
@ajax66235 жыл бұрын
thanks man, appreciate you
@stevanandric25665 жыл бұрын
Thanks man
@Thiago13375 жыл бұрын
setx PORT 5000
@JauVi856 жыл бұрын
This is great! Nicely explained. There are tons of those tutorials in which they just do tons of stuff while telling that they do all this stuff but NOT telling WHY.
@LuliiThePetBestie5 жыл бұрын
What a great tutorial! Keep up the good work.
@martind544 жыл бұрын
Mosh, such a clear and fully comprehensive tutorial. Very professional video. I will get the course straight away.
@josiahchristensen13116 жыл бұрын
There is an issue with your PUT request logic. Let me give you an example. You have the course id's [1, 2, 3]. Then you delete [1]. So you have [2, 3] with length 2. Your PUT assigns the id (length + 1) which is equal to (3), so now you have the course id's [2, 3, 3] so you also need a validiateCourseID() function in order to ensure you don't have duplicate course id's because when calling a GET request on id=3 you will get duplicate results.
@josiahchristensen13116 жыл бұрын
Programming with Mosh alright that makes sense. It's just that you taught the course as if we have prior JavaScript knowledge, and hopefully any programmer would have been able to catch a fatal error such as that. Because that would allow you to have lots of duplicate id's.
@dylanbacon50476 жыл бұрын
could just use --> id: courses[courses.length-1].id +1
@osaenzm6 жыл бұрын
let maxId = 1; if (courses.length > 0) { maxId = courses.reduce((max, c) => c.id > max ? c.id : max, courses[0].id) + 1; }
@Gustavo-uc9rr2 жыл бұрын
What a great tutorial! I knew most of the content but I watched the entire video because it's so well structured. Congratulations.. Your teaching skills are impressive! I normally skip some parts of most of >20min videos on KZbin but I watched every little second of this one...
@timbermonson4 жыл бұрын
Helpful tip: for setting the environment variable in the "PORT" example, "set PORT=5000" may not work in Windows. $env:PORT = 5000 worked for me instead.
@djimenez0174 жыл бұрын
Thank You!!
@mohiuddinshahrukh2 жыл бұрын
Thanks bud
@srigoutham10583 жыл бұрын
Thank you so much sir for your excellent and detailed explanation of things. I started going through your videos for nodejs and then I have subscribed for the entire course and I cracked 4 interviews as a nodejs developer. Thank you once again for all your effort.
@_mayankr5 жыл бұрын
joi is deprecated, express-validator is an alternative that can be used now.
@Colstonewall5 жыл бұрын
No, it's just been moved here: hapijs.com/tutorials/validation. If you would've read the page, it says "This module has moved and is now available at @hapi/joi. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues."
@markomaric49755 жыл бұрын
If I had enough money, I would buy everyone a course! Excellent !!!
@AvinashSingh-nq5ud6 жыл бұрын
Awesome,Please upload more videos on building api
@DefriaManda6 жыл бұрын
You can find all of this here: www.udemy.com/user/moshfeghhamedani/
@Dcooper6763 жыл бұрын
i can't express the happiness i am getting thanks a lot mosh sir
@Pr0Cre4 жыл бұрын
Okay why at 47:27 gets the whole courses updated when we only have the "course" which we extracted from the courses with the find function Edit: solved
@libruhh27854 жыл бұрын
Don't ever just edit some problem you've posted about to say "solved." Share what the solution was so that others who are experiencing the same issue can learn from your question.
@rafagawlikowski92674 жыл бұрын
It's because of JS nature - whenever you assign some existing object/array to some variable, you actually get the reference to that object/array (not its copy) Check it out yourself in the console let obj1 = {a: 1} let obj2 = obj1 obj2.a = 4 console.log(obj1.a) // 4 That's because it's the same object console.log(obj1 === obj2) Ahh - and also notice that {a: 1} === {a: 1} // false That's because of how JS checks equality of objects
@coolrock37333 жыл бұрын
@@rafagawlikowski9267 Thanks for taking the time to type this out and explain
@jeenee_5 жыл бұрын
I'm buying the course! I need to learn Javascript and Node and so far, this is one of the best tutorials I've seen! :)
@marufhasan93656 жыл бұрын
How do you know what will be returned from the request " require("module_name") " . For example you said require("express") returns a function and require("joi") returns a class. I am wondering where i can find those information.
@alexandernordstrom16174 жыл бұрын
Excellent question! You'd have to either look at the documentation for the module or explore it yourself, and the easiest way to do that is to run node interactively. Just run node without arguments from the command line, type in the require statement for the module and hit enter. If we're nitpicking, require("joi") returns doesn't return a class but rather an object of the class that it defines.
@KDOERAK6 жыл бұрын
Another excellent course by Mosh: clear, to the point, practical. Not a waste of time. Thx!
@DrazV25 жыл бұрын
I can't get the PORT environment variable to work on Windows 10... What am I doign wrong? I've tried git bash, powershell and going through the system properties. I've tried $env:PORT, export PORT, set PORT, PORT... Also for some reasons I couldn't get the PUT and DELETE requests to work.
@RenuRawat5 жыл бұрын
You can use cross-env. It will let you use environment variables across platforms. Accessing process environment variables is always a problem in windows machines. You can simple install it by running the command- npm I cross-env -D Then go to your package.json file inside scripts section you will see the start command, simple replace it with "cross-env PORT=3000 npm start" (Just prepend cross-env before the star command)
@RenuRawat5 жыл бұрын
Regarding you your second query it may be some problem with the routing. Happy coding
@durgaprasadvanapalli94884 жыл бұрын
Hi Mosh, Ur English is most understandable by other countries people, thanks....
@karimkhabourii51056 жыл бұрын
Can u upload it in Udemy ?
@ggggggg00002 жыл бұрын
this guy is the best teacher, hands down
@kavyaagrawal20133 жыл бұрын
"And I know this probably doesn't make any sense to you... ...because it was introduced by a *p h p s t u d e n t* " I DIED XD
@nap4lm2383 жыл бұрын
"PhD student as part of his thesis", not PHP
@hamedganjeali67353 жыл бұрын
You rock! I wonder why haven't I found your channel 'till now. tnx for your spectacular tutorials
@lathakumari626 Жыл бұрын
How to get and post real data is not shown. This video is not worth watching for an hour.
@chiragBharadwaj21 Жыл бұрын
For that u have to pay...
@trungnguyen59474 жыл бұрын
Your teaching style and your voice, explanation is super clear, easy to understand, the animation and presentation are awesome
@156vini2 жыл бұрын
I love your courses, the only problem is you don't update them. You are the world's best teacher Mosh.
@bharathnivas292 жыл бұрын
Really thanks for this wonderfully course. I understood the basics of backend because of u . I watched many lectures but I didn't understand properly
@j.hanleysmith83336 жыл бұрын
Anyone else see the irony in building a video rental app :D. Thanks Mosh, great video!!!
@ollysalanson94523 жыл бұрын
These vids are so good, I've been watching your channel for 48hours - sleep and I'm nearly at the stage of making my own API :D
@dipendra-sharma4 жыл бұрын
I became a fan of you. Watched your 3 videos back to back.
@eruston6 жыл бұрын
Great tutorial. I always like it when an instructor can admit that there was a bug in what they were coding. Very humble and I like seeing the trouble shooting that the teacher goes through. Great course, I am studying writing smart contracts for cryptocurrencies, and originally watched your video because it came up in a list of videos under the query 'json'. Very fortunate that I found your work, I will be back to udemy to take your course!
@dejanstojkovic63704 жыл бұрын
Mr. Mosh your video lectures are just as Tina says in her song: Simply The Best. Thanks a lot.
@darshplaysmc10153 жыл бұрын
This is the best course in the world for node and express!!!!
@Ov3RFLoW883 жыл бұрын
This tutorial helped us to solve our problem. Some SDKs we want to use is written in node, but our code base is go. Hence we connect to node to use the SDK and return the result to Go