I've used a lot of different youtubers, website tutorials, and even codeacademy. I'm not sure what you are doing different but it's finally actually going in! I think it's because you don't bloat the tutorial with unnecessary extra technology. And you also explain the purpose of everything you write. But this has definitely been the best tutorial on Node JS that I've watched. Thanks a lot!
@jazzbandpiano4 жыл бұрын
Max you are making the most brilliant tutorials on KZbin for this stuff right now. The way you let errors hit Postman and the backend, so that we can follow along with you and prevent them ourselves, is a real lifesaver. Keep up the content!!!
@carolinenunes29372 жыл бұрын
god, it feels SO good when you're watching a tutorial video and you can simply understand everything is going on without pausing and going back, even if it's the first time I see it. What an awesome instructor, im pretty luck to have found you :)
@teawacrossman-nixom76963 жыл бұрын
been surfing the internet for an explanation on how to work with CORS for hours now, and you my good sir, was the only person who actually explained it in a comprehensive and digestible way. Also the quick and concise explanations mixed with the beautiful face make the whole learning 100% easier, Thanks man :)
@TechInterpreter3 жыл бұрын
This is the best, clearest, most simple explanation I've come across (and I've watched a lot of them!) Thank you for this.
@titaniumcoder4774 жыл бұрын
This is a great series! I am a developer but have never created a REST API web server. This is so much fun! You are an awesome instructor! Keep up the good work!
@asifsharif20736 жыл бұрын
I was waiting for this explanation for last at least 5-6 months. Nobody able to explain it to me. Seriously you did a great job ^-^
@academind6 жыл бұрын
That's really fantastic to read, thanks a lot for sharing this awesome feedback!
@murat60182 жыл бұрын
Agreed with the comments. I've been having troubles understanding creating rest APIs and these tutos are just heaven sent!
@The_Nova_Glow5 жыл бұрын
This guy is a mad genius!!
@АлександрМерный-м1ч3 жыл бұрын
Man... you are the best! Now, in 2021 this is the best course I have watched.
@ameyaghadigaonkar66304 жыл бұрын
Solved my cors issue with your code. Great video brother. Thank you. was not able to find solution for a long time. you have great knowledge of rest api.
@yogxoth19594 жыл бұрын
Best explanation of CORS that I've seen. Thank you!
@conaxliu96775 жыл бұрын
Wonderful! I was looking for solution to CORS but no one else had provided this in their videos, at least I didn't find any, until I see yours. The Postman tool is also quite a handy tool that you have introduced. Thank you very much!
@roygates63285 жыл бұрын
Great Series Max, very clear, well structured and concise tutorials \o/ without being rude to all the other tutorial producers, I often find it difficult to follow their english or accent, yours are excellent. Top Job!!!
@academind5 жыл бұрын
Thank you Roy, happy to read that!
@SatishSingh-ep9wi4 жыл бұрын
Thank good man I have facing this cors error problem from last 6th months in my every project.But after watching your video my problem has been solved. Thanks and always be making such type of content. One hint for others-- always mention app.use(cors()) above the header codes what they say in this vedio.
@markclinton79958 ай бұрын
If it's not MAX I don't know who else, from youtube turorials down to Udemy courses, he sure knows how to make the knowledge and info you need sink into your brain with EASE!
@nat61064 жыл бұрын
Best CORS explanation ever, thanks! 👏
@creazy23127 жыл бұрын
I tried to use the tutorial to create a rest api for my SPA and all requests failed, just because of the Access-Control-Allow-Headers. After some hours I spent on google, I found the same solution you present in this video :D so the tutorial comes a bit to late for me but never mind - awesome and helpful tutorial like every other other :) THANKS A LOT !
@academind7 жыл бұрын
Still great to read that the tutorial was (or well, would have been) helpful, thanks a lot for sharing this :)
@rochbajracharya38816 жыл бұрын
How did you solve the problem of all request failing?
@VictorvictorRamos6 жыл бұрын
:(
@JustSkillGG4 жыл бұрын
By far the best channel on its category! Your explaining of things is so damn clean!
@ahmadhassan56803 жыл бұрын
I really love this serious(series).
@mariolinovalencia77766 жыл бұрын
You are simply awesome. I love your courses on KZbin and Udemy I was having problems with CORS and spent time looking for the solution. Your video has helped me
@academind6 жыл бұрын
Awesome to read that the video was helpful for you Mario! Thanks a lot for your support here and on Udemy!
@somebodyyouusedtoknow86004 жыл бұрын
Hello, amazing video. Just wanted to say that there is now an npm package called cors that you can use on your middleware to avoid cors issues.
@alexisflores53294 жыл бұрын
Thanks! Just started learning more about cors and this makes it super easy
@mhasheem13053 жыл бұрын
best teacher and way of teaching is excellent
@islamway_to_jannah4 жыл бұрын
best youtube channel in the planet
@mjr3334 жыл бұрын
Best explanation of CORS I've seen
@phamnhans5 жыл бұрын
You are my inspiration and role model. Thank you, teacher!
@amitkumargouda17685 жыл бұрын
This guy made me understand cors.
@ramonmurillo1677 жыл бұрын
Great video Max. It will be great if you could do the next one about securing the API using tokens.
@academind7 жыл бұрын
I will cover that, no worries - thanks for your great feedback Ramon!
@therealchrif7 жыл бұрын
Max, Please make a video about linking our API with a SPA. and thanks for all your videos
@NuubiKakku4 жыл бұрын
Thank you a lot! Very helpful and wholesome content!
@_the_one_17 жыл бұрын
Very good explanation of CORS!!!I like very much the moment when you say 9:30
@academind7 жыл бұрын
Thanks so much, awesome to hear that!
@sayamqazi6 жыл бұрын
6:07 you can send numbers though on the value side "price" : 12.99 this is valid
@Fernando_SC4 жыл бұрын
MEEEEEEN THANKS!! YOU ARE A FUCKING GENIUS, NO ONE EXPLAIN IT BETTER THAN YOU. I WAS STUCKED IN THIS F** PROBLEM FOR A WEEK, THX A LOT MEN!!!
@edgardogonzalez28123 жыл бұрын
That was amazing!!!!
@JaikratSinghTariyal6 жыл бұрын
If you are not able to call any of your API then put next(); after closing if (req.method === 'OPTIONS') {...}
@TheMaxik5 жыл бұрын
Thaaaaaaaaaanks man!
@raynesmike5 жыл бұрын
@Jaikrat thanks man youre dope
@shikhargupta39284 жыл бұрын
This should be pinned.
@lucaspaiano86874 жыл бұрын
thanks dude!
@joydeepbhattacharjee53053 жыл бұрын
Thanks man u save my day ! God bless u ❤️
@johntenorio90863 жыл бұрын
¡Thank you so much! Just what I needed.
@vicliur25 жыл бұрын
THANK YOU! I had so much trouble with CORS but you saved me!
@elecktromaestimmy4 жыл бұрын
now you can just install it npm install cors
@This__is__akash4 жыл бұрын
Already purchase React and Node js course.
@matthiasmuller76775 жыл бұрын
Verry gut tutorial! Sänk you for se tschörman accent, makes me understand easier
@Palonchi-n1t Жыл бұрын
Thanks for sharing such knowledge to us. I am so excited of watching this course. I have another question related to this lecture. I am so confused about CSP. I tried a small project to practice. actually, I used axios for my front-end, when I fetch the data, on my browser console, content security policy is blocking my localhost, I do not know how to handle with this issue. by the way, thank you very much!!!
@rhaindeathlcook4 жыл бұрын
Thank you for the clear explanation!
@FilipCodes4 жыл бұрын
Awesome video!!
@therealchrif7 жыл бұрын
Max, Please make a video about linking this API with a SPA. and thanks for all your videos
@christopher57315 жыл бұрын
Max you have the best videos
@academind5 жыл бұрын
Thank you!
@tungtran76674 жыл бұрын
Thank you for author... This is a very good course
@skypan77866 жыл бұрын
Hi Max, I am your big fans. I find out that in the video 13:50, It need add next() at the end of header set function, or it will keep loading if it does not go into the if statement.
@donathmm38815 жыл бұрын
he did it after that
@RaymondAtivie7 жыл бұрын
You're a saint Max
@academind7 жыл бұрын
Thanks so much Raymond!
@The7azem6 жыл бұрын
Thanks for the great tutorial, just one notice that price can be an int in json, values in json can be either numbers or strings, only the name needs to be in text form
@andriis19177 жыл бұрын
Great tutorial!! Thank you for what you are doing!
@academind7 жыл бұрын
Thanks so much Andrii, makes me really happy to read that!
@arfeenmalik83314 жыл бұрын
For anyone who was also getting errors "...undefined" in response body: You must make sure that you define all configurations BEFORE defining routes.
@evgenykhristenko40474 жыл бұрын
thx helped
@eshaalraani19032 жыл бұрын
i was stuck for almost 3 days, tried everything watched almost 10+ videos 🤣🤣 and the answer to my problem was in the comments, thank you so much for sharing
@israelruas948 Жыл бұрын
I high recommend this tutorial.
@bidyutmahanta854 жыл бұрын
Thank you, you solved my CORS issue. 👍
@sounak20095 жыл бұрын
Why can't we just app.use(cors()) after installing the cors Npm package instead of manually updating the res headers?
@MS-xu1ks5 жыл бұрын
I do the same, works fine.
@عبدالقادرعبدالرحمنعبدالله5 жыл бұрын
I did cors the same way as done in the tutorial but failed to work. As going through comments, i came across your comment that helped me fix it. Thanks a lot.
@hazemmohamed28725 жыл бұрын
@@عبدالقادرعبدالرحمنعبدالله The headers added in the video should fix cors errors in many browsers, but some browsers like safari requires a small tweak which the cors package handles. In my opinion, it's better to use the cors package than writing the headers yourself (which indeed do the same but handles most suituations).
@gouravgosain87336 жыл бұрын
Complete tutorial is really helpful
@sachin__ak4 жыл бұрын
For cors now you can use ' app.use(cors()) ' after installing cors by 'npm i cors' , hope it helps :)
@Nope221193 жыл бұрын
this didn't work for me
@sachin__ak3 жыл бұрын
@@Nope22119 did you do npm I cors?
@Nope221193 жыл бұрын
@@sachin__ak yup, i solved the issue, but this wasn't it. I was passing an extra thing into the request "mode: 'cors'". after getting rid of that it worked
@sachin__ak3 жыл бұрын
@@Nope22119 app.use(cors()) not the recommended way to use it on production, you will have write a config options, check out the docs of cors.
@barjosa31blogspot837 жыл бұрын
Thanks again Max! Helpful!
@academind7 жыл бұрын
Great to read that, thanks a lot!
@Userk862884 жыл бұрын
It worked. Thanks a lot
@alexandertarasenko30386 жыл бұрын
You are great and your tutorials are awesome) Thank you for doing this) I have one small question. We could also just do req.body and receive the entire object of product, right? Is it considered to be a bad practice? Thank you for the answer)
@user-xw4mu6nz4t3 жыл бұрын
JSON data can include; numbers, booleans, objects, arrays and strings null (not undefined). Not *just* strings.
@neelk74454 жыл бұрын
if anyone is having trouble with body-parser, do not use bodyParser.json() replace it with express.json() . keep req.body.productID as it is
@OXiG9610 ай бұрын
Hello forum, the noob here Why do postman give me result of "message": "Handling POST requests to /products" at 6:10 and before? I did everything identically to the author
@El_ii6 жыл бұрын
Hey Guys, before using the CORS error handling function (res.header...) install it with npm install cors --save. I spended an hour to figuring out why this wasn't working. :D
@veliea51605 жыл бұрын
if u installed the cors, u dont need all heavy duty complex function code. cors module will handle everything for u
@ИльяКарев-р9ф7 жыл бұрын
Dreaming about future courses where you'll use toys to explain the client-server interactions :)
@academind7 жыл бұрын
Haha - not a bad idea :D
@IAmUnstoppable5556 жыл бұрын
What shortcut key combination did you pull to do the auto indentation at 11:51?
@reza0razavipour6 жыл бұрын
I love theses presentations from the speaker. Is the code accessible online?
@academind6 жыл бұрын
Thank you! You can find the source code below the video if you click onto "Resources" => academind.com/learn/node-js/building-a-restful-api-with/parsing-the-body-handling-cors/
@codinginflow3 жыл бұрын
Why do you use sometimes double quotes and sometimes single quotes? Is that equivalent?
@mohammedfalih87133 жыл бұрын
I think there is no difference
@janpawedwa45903 жыл бұрын
there is no difference, and if you use any linter, it will probably keep all your quotes consistent, when you format your code (for example on save)
@rameshrathod017 жыл бұрын
Plz make video using MySQL login with passport js and SSL using nodejs
@rscottlewis15 жыл бұрын
Great job. Thanks for sharing.
@academind5 жыл бұрын
Thank you Scott :)
@sandum1507 жыл бұрын
Hi Max! It's an awesome course. But could you tell what db are you going to use?
@academind7 жыл бұрын
I'll start with MongoDB. Maybe I later also show how you could use MySQL but I'm not decided on that yet.
@sandum1507 жыл бұрын
It'll be great to use some SQL db, like MySQL or PostgreSQL. There are so few tutorials with nodejs + SQL. I wait eagerly for that.
@andreyq91796 жыл бұрын
Thanks a lot from Russia ; )
@academind6 жыл бұрын
Thank you Andrey, greetings from Germany :)
@PauloRodrigues20005 жыл бұрын
Explicação massa ! muito obrigado
@sourajitbasu31693 жыл бұрын
bodyParser is deprecated now... Express provides parsing out of the box now for v4.16 and above
@HimanshuSingh-fh7dt3 жыл бұрын
same, how can we resolve this problem?
@HimanshuSingh-fh7dt3 жыл бұрын
app.use(express.json()); app.use(express.urlencoded({ extended: true })); this is working for me
@sourajitbasu31693 жыл бұрын
@@HimanshuSingh-fh7dt exactly. This is how it recommended now.
@kilar964 жыл бұрын
Thank you very much !!
@AbhishekKumar-mq1tt7 жыл бұрын
Thank u for this awesome video .Can you also implement front end with this .u r awesome
@academind7 жыл бұрын
I'll probably add some frontend later in this series, yes
@chidinwaka92315 жыл бұрын
Thank you very much, it was so helpful.
@martinsmuts25577 жыл бұрын
Thanks for these awesome videos. I was wondering how do you parse the body if you do not know the schema? For example, we expected to get price and name parameters, but what if you do not know what parameters to pass if you do not have documentation?
@academind7 жыл бұрын
If you're creating the API for yourself, you obviously know what you expect to receive and what you therefore should pass. If you create an API that's also consumed by other, you have to create a detailed documentation for sure
@martinsmuts25577 жыл бұрын
Thanks for your reply. Yes, I understand that if you create your own one then you would know what to expect and create your own documentation. Was just wondering if it is possible to retrieve all parameters in the body that are available without parsing them one-by-one? For example, you listen for all the possible available parameters in the request.
@abhihuntergamer11505 жыл бұрын
Thank you soo much..Very well explained
@academind5 жыл бұрын
Happy to read that, thank YOU for your comment!
@abhihuntergamer11505 жыл бұрын
I was actually having trouble in connecting api to Angular 7. I was getting this error . I took your Udemy Angular course. It’s just awesome very well explained
@MohamedJamalAli6 жыл бұрын
Hi Max, in 04:26 you said that CORS is not a good way to protect our API from un desired access, so what is the best way to protect our API from un wanted access?
@jybs84764 жыл бұрын
Couldn't we check for the OPTIONS method first so that no time is wasted on adding unnecessary headers?
@amitbhandari83476 жыл бұрын
I am lucky to get this playlist... DHANYABAD
@SweatyCubes6 жыл бұрын
Before adding "res.header('Access-Control-Allow-Headers', 'Content-Type');" POST Requests work. After adding it though breaks them and then logs an error saying that No Access-Control-Allow-Origin is present even though it is. Strange.
@ankurvishwakarma87316 жыл бұрын
Nice tutorials sir ..!!
@yuliat53435 жыл бұрын
So we don't need to install cors package in order to use it the way it is presented in the video?
@qaipak17 жыл бұрын
in 10:20 we are making another app.use(). If it gets routed to that, how does it reach the other routes? I don't quite understand that step.
@qaipak17 жыл бұрын
I'm an impatient bitch. Nvm
@mycomputer75393 жыл бұрын
Thanks a lot sir.
@harsimerkaur47924 жыл бұрын
Can we use npm package cors?
@raghavaggarwal86444 жыл бұрын
Thanks for the tutorial but how to deploy the server online? I'm building a rest api for my android app so basically i want to know how to use this with android? I will need a url right?
@levisolomon92534 жыл бұрын
can we use app.use(cors()); instead of writing headers for each and everything?
@CarlosRodriguez-yw9fw5 жыл бұрын
Hi Max! I really like your videos, are helping me with an API develop. I have a question about CORS. This API might be private, only for people who works in a company, so, maybe it will have only the company website domain on the Access-Control-Allow-Origin. But, what if in the future, it develop some mobile app that will consume this API. How to configure this CORS header that allow the mobile app to consume it? Hope you or anybody can help me with this doubt. Thanks a lot!
@KatanaHSM4 жыл бұрын
[HELP] Why are we returning a status response after checking for OPTIONS? I'm a little confused here!
@kobenade4 жыл бұрын
Is there anywhere to do this with fetch api
@javierzetina16213 жыл бұрын
Champioooooooon!!!
@arockiamkaspar23007 жыл бұрын
Hi MAX, great video. Why it works only on localhost:3000/ and not in any other domain like localhost:4000/. since it accepts cross origin requests.
@88noname884 жыл бұрын
UPDATE: you can use middleware. Install cors from npm and simply add middleware to app.js. Just app.use(cors())
@Nope221193 жыл бұрын
the cors library didn't work for me
@investingthelike1114 жыл бұрын
what do you mean by acces-control-allow-headers? can anyone explain this in more details , why do you send a header with a request?
@ashik_shanto3 жыл бұрын
Body parser is deprecated. What should i do?
@matejl927 жыл бұрын
Price can be of type double/decimal.
@farhantubeify7 жыл бұрын
Nice video. But things look time consuming and too many codes. I think for API we should go for adonis or sails. Those MVCs are pretty good for people coming from other MVCs like Laravel or Ruby on Rails or Spring.... Thanks again...
@academind7 жыл бұрын
That's the cool thing - you got all these great options :)
@G0YoX5 жыл бұрын
Very very thanks!!!
@mdjahidulislam92054 жыл бұрын
Hi . urgent help.. Cors is not working with multer,form-data. I can't upload photo.