Enables Cross-Origin Resource Sharing (CORS) middleware. Allows requests from another domain to the application by setting appropriate headers.
MDN CORS
// Enable CORS in config/config.jsexport default { cors_enabled: true}; Copy
// Enable CORS in config/config.jsexport default { cors_enabled: true};
Static
Mount CORS middleware on Express application. Sets appropriate CORS headers to allow cross-origin requests.
Express application instance
// This method is called automatically by express-sweet.mount()import CORS from './middlewares/CORS';await CORS.mount(app); Copy
// This method is called automatically by express-sweet.mount()import CORS from './middlewares/CORS';await CORS.mount(app);
Enables Cross-Origin Resource Sharing (CORS) middleware. Allows requests from another domain to the application by setting appropriate headers.
See
MDN CORS
Example