CORS express.js tutorial | Cross-Origin Resource Sharing in Node
Vložit
- čas přidán 26. 07. 2024
- 🔥More exclusive content: productioncoder.com/you-decid...
Twitter: / _jgoebel
Blog: productioncoder.com
Website: jangoebel.com
In this video we cover what CORS (Cross Origin Resource Sharing), why you need and how you can customize your express server's behaviour. We cover how to use CORS in express and how to enable OPTIONS requests to allow CORS preflights.
We cover the complete CORS setup from scratch and build a custom CORS middleware that returns Access-Control-Allow-Origin HTTP headers.
00:00 Introduction
00:20 What is CORS (Cross Origin Resource Sharing)?
01:03 What is an origin?
02:05 Where is CORS used?
02:42 How CORS works
05:18 CORS and Postman
06:18 Relaxing security requirements with CORS
06:54 CORS preflights
10:33 Implementing CORS in express.js
12:17 Custom CORS configuration in express
13:49 CORS middleware in express
14:49 Allowing multiple CORS origins
15:53 CORS Origin headers
17:24 OPTIONS requests in express for CORS
20:00 Conclusion
What do you think about this video?
Please let me know in the comments below.
awesome.
Super awesome
More than super awesome
Finally someone explains it properly! Thanks!!
Glad you liked it!
Thank you for explaining it in such detail. I looked for many videos for CORS explanation and yours might be one of the best ones.
I have watched many videos, more than helping me understand the concept, it confuses me a lot. But your videos are clear to the point! Keep making great content! 👍
thx Gomathi 👍
5:44 - Wow, I was seriously telling me self this CORS is not protecting the server and then you mentioned about POSTMAN and changing the header... Excellent explanation on the topic on the theory of CORS.
Best explanation, was using CORS for a year, but today got to know the exact working of it behind the scene.
glad to hear you found it helpful
Thank you so much for this video. I now have a better understanding of CORS.
Great to hear!
Your channel is a hidden gem!
thx Rounik
My hero
Great video as always! Keep up the good work!
Thanks! Will do!
This has greatly helped me understand CORS. Please keep making videos!
thx, please let me know if you have any specific video ideas.
@@jgoebelI would be interested in seeing your process of building a PERN stack application (with knex). I've seen other videos for PERN stack builds but many are either outdated or aren't as 'well explained' as your own.
Dude I was with that bug for 2 days, you saved my life haha thanks :D
you're welcome yonathan 👍
This is a great job you deserve more viewers.
thx Sam 👍
awesome, clear explanation.thanks
Glad you liked it
wonderful explanation
Glad it was helpful!
Great content! Cheers
Thank you! Cheers!
Thank you so much. I like your explanation. It is very clear to understand.
Glad it was helpful!
You are awesome. Really thank you very much
thx Ali 👍
good explanation and thanks.
Glad it was helpful!
good tutorial! thx
Hi Viktor, thx I'm glad you liked it!
Nice tutorial
Thanks Amit
Another great video, thanks man. I second the other commenters suggestion of creating a PERN stack application, but in terms of a more scalable / prod level app, instead of a simple app like every other video. Something that would actually be used in a more serious level. Also hoping to see maybe some videos on docker and kubernets in the future.
thx for the video ideas 👍
thanks a lot, useful info=))
Glad it was helpful!
hi man.. great explication!
Glad it helped!
Thanks a lot man! Great explanation.
Glad it helped!
I have a React js (axios) application on the client side and Node js (express) on the backend. I use aws iis ec2 as my hosting server. All works fine both in development and production, except when I connect to Veepn Chrome (from production) then my token header is not found. I have no idea what's happening.
the video image is too poor, you need to fix it more
this is amazing explanation!!
Glad you think so!