@types/koa__cors
- Version 5.0.0
- Published
- 5.35 kB
- 1 dependency
- MIT license
Install
npm i @types/koa__cors
yarn add @types/koa__cors
pnpm add @types/koa__cors
Overview
TypeScript definitions for @koa/cors
Index
Functions
function cors
cors: (options?: cors.Options) => Koa.Middleware;
CORS middleware factory.
Parameter options
Configuration options.
Returns
cors middleware
Interfaces
interface Options
interface Options {}
Middleware configuration options.
property allowHeaders
allowHeaders?: string[] | string | undefined;
Access-Control-Allow-Headers
property allowMethods
allowMethods?: string[] | string | undefined;
Access-Control-Allow-Methods
, default is 'GET,HEAD,PUT,POST,DELETE,PATCH'
property credentials
credentials?: | ((ctx: Koa.Context) => boolean) | ((ctx: Koa.Context) => PromiseLike<boolean>) | boolean | undefined;
Access-Control-Allow-Credentials
Remarks
If a function is provided, it will be called for each request with the koa context object. It may return a boolean or a promise that will resolve with a boolean.
property exposeHeaders
exposeHeaders?: string[] | string | undefined;
Access-Control-Expose-Headers
property keepHeadersOnError
keepHeadersOnError?: boolean | undefined;
Add set headers to
err.header
if an error is thrown
property maxAge
maxAge?: number | string | undefined;
Access-Control-Max-Age
in seconds
property origin
origin?: | ((ctx: Koa.Context) => string) | ((ctx: Koa.Context) => PromiseLike<string>) | string | undefined;
Access-Control-Allow-Origin
, default is '*'Remarks
If a function is provided, it will be called for each request with the koa context object. It may return a string or a promise that will resolve with a string.
property privateNetworkAccess
privateNetworkAccess?: boolean | undefined;
Handle
Access-Control-Request-Private-Network
request by returnAccess-Control-Allow-Private-Network
, default isfalse
See Also
https://wicg.github.io/private-network-access/
property secureContext
secureContext?: boolean | undefined;
Add
Cross-Origin-Opener-Policy
&Cross-Origin-Embedder-Policy
to response headers, default isfalse
See Also
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/Planned_changes
Package Files (1)
Dependencies (1)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/koa__cors
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/koa__cors)
- HTML<a href="https://www.jsdocs.io/package/@types/koa__cors"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3443 ms. - Missing or incorrect documentation? Open an issue for this package.