CORS in Express
noun
say it: “KORZ in ek-SPRES” /kɔrz ɪn ɪkˈsprɛs/
The cors middleware for Express, which adds the headers that let web pages on other origins call your API.
What is CORS in Express?
The cors middleware adds headers that let web pages on other domains call your API.
import cors from 'cors';
app.use(cors({ origin: 'https://www.example.com' }));
In a sentence
- “Without CORS in Express, the browser hid every answer from the front end on another port.”
- “CORS in Express is one line: app.use(cors({ origin: "http://localhost:5173" })).”
Level: Journeyman · More Node.js terms at this level
Updated