Using CORS in Express

In this post I will show you how to enable CORS support in Express. I will also provide some tips to handle common use cases that come up when working with Single Page Applications, like exposing HTTP sessions and custom headers.

Enabling CORS

The easiest way to get CORS working in Express is by using the cors npm module.