Express 5 · Middleware

Enable CORS

Allow browsers on other origins to call your API.

npm install cors

import cors from "cors";
app.use(cors({ origin: "https://app.example.com" }));

Official Express 5 documentation

More middleware commands

All middleware commands · Express 5 cheatsheet

Was this page helpful?