UNPKG

dewy

Version:

Dewy(dǝw-y) is a minimalist HTTP server framework with a small codebase, utilizing built-in URLPattern for efficient routing.

46 lines (45 loc) 1.19 kB
import "../_dnt.polyfills.js"; import { MiddlewareHandler } from "../router.js"; export interface CorsOptions { /** * if set true, use next() response, if false, use 204 * @default false */ preflightContinue?: boolean | null; /** * Access-Control-Allow-Origin * @default "*" */ allowOrigin?: string[] | null; /** * Access-Control-Allow-Methods * @default "GET,HEAD,PUT,PATCH,POST,DELETE" */ allowMethods?: string[] | null; /** * Access-Control-Allow-Credentials * @default false */ allowCredentials?: boolean; /** * Access-Control-Allow-Headers * @default response Access-Control-Request-Headers */ allowHeaders?: string[] | null; /** * Access-Control-Expose-Headers * @default (no header) */ exposeHeaders?: string[] | null; /** * Access-Control-Max-Age (in seconds) * @default (no header) */ maxAge?: number | string | null; /** * Access-Control-Allow-Private-Network * @default false */ allowPrivateNetwork?: boolean | null; } export declare function cors(options?: CorsOptions): MiddlewareHandler;