Skip to content

Taxum / @taxum/core / middleware/cors / AllowOrigin

Class: AllowOrigin

Defined in: middleware/cors/allow-origin.ts:13

Holds configuration for how to set the Access-Control-Allow-Origin header.

See

Methods

any()

static any(): AllowOrigin

Defined in: middleware/cors/allow-origin.ts:51

Allows any origin by sending a wildcard (*).

Returns

AllowOrigin


default()

static default(): AllowOrigin

Defined in: middleware/cors/allow-origin.ts:20

Returns

AllowOrigin


exact()

static exact(origin): AllowOrigin

Defined in: middleware/cors/allow-origin.ts:58

Allows a specific origin.

Parameters

origin

string

Returns

AllowOrigin


from()

static from(like): AllowOrigin

Defined in: middleware/cors/allow-origin.ts:24

Parameters

like

AllowOriginLike

Returns

AllowOrigin


list()

static list(origins): AllowOrigin

Defined in: middleware/cors/allow-origin.ts:67

Allows a list of origins.

Parameters

origins

string[]

Returns

AllowOrigin

Throws

Error If the list contains a wildcard (*).


mirrorRequest()

static mirrorRequest(): AllowOrigin

Defined in: middleware/cors/allow-origin.ts:87

Allows any origin, based on a given predicate.

Returns

AllowOrigin


predicate()

static predicate(predicate): AllowOrigin

Defined in: middleware/cors/allow-origin.ts:80

Allows a list of origins, based on a given predicate.

Parameters

predicate

AllowOriginPredicate

Returns

AllowOrigin