🔥More exclusive content: https://productioncoder.com/you-decide-what-we-build-next
Twitter: https://twitter.com/_jgoebel
Blog: https://productioncoder.com
Website: https://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