When a frontend app (e.g., React running on http://localhost:5173) calls your Express API on http://localhost:3000, browsers block the request by default due to the Same-Origin Policy. The cors middleware adds the required Access-Control-Allow-* headers.
Production Tip
Never leave origin: '*' open when using cookies or credentials. Whitelist your exact frontend domain(s).