Skip to content

Allow configuring CORS asynchronously for express #3612

@michieldewilde

Description

@michieldewilde

Packages used:

  • apollo-server (2.9.13)
  • apollo-server-express (2.9.13)

Expected

By using the applyMiddleware function to connect apollo-server to express you can pass on cors option.
This cors option can be a Boolean or a CorsOptions object.
The apollo-server-express uses the cors package.
This package allows a third option to be passed: CorsOptionsDelegate.
This option allows CORS to be configured asynchronously.
Type definition: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/31483b781ac30f98bdf4d40a517e921f2fc2ce37/types/cors/index.d.ts#L25

For the sake of completion this option should be available.

export interface GetMiddlewareOptions {
    cors?: corsMiddleware.CorsOptions | corsMiddleware.CorsOptionsDelegate | boolean;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions