Express Sweet API Reference - v3.0.0
    Preparing search index...

    Class CORS

    Enables Cross-Origin Resource Sharing (CORS) middleware. Allows requests from another domain to the application by setting appropriate headers.

    // Enable CORS in config/config.js
    export default {
    cors_enabled: true
    };
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Mount CORS middleware on Express application. Sets appropriate CORS headers to allow cross-origin requests.

      Parameters

      • app: Express

        Express application instance

      Returns Promise<void>

      // This method is called automatically by express-sweet.mount()
      import CORS from './middlewares/CORS';

      await CORS.mount(app);