@buntal/core - Middleware

cors

CORS (Cross-Origin Resource Sharing) middleware for handling cross-origin requests in Buntal applications.

Source

View source on GitHub

Type Definition

function cors(options?: CorsOptions): AtomicHandler

type CorsOptions = {
  origin?: string | string[]
  methods?: string | string[]
  allowedHeaders?: string | string[]
  exposedHeaders?: string | string[]
  maxAge?: number
  credentials?: boolean
}

Parameters

ParameterTypeRequiredDefaultDescription
optionsCorsOptions-CORS configuration options

Properties

PropertyTypeRequiredDefaultDescription
originstring | string[]*Allowed origins for cross-origin requests
methodsstring | string[]GET, HEAD, PUT, PATCH, POST, DELETEAllowed HTTP methods
allowedHeadersstring | string[]Content-Type, Authorization, X-Requested-WithAllowed request headers
exposedHeadersstring | string[]-Headers exposed to the client
maxAgenumber600Preflight request cache duration in seconds
credentialsbooleantrueWhether to include credentials in CORS requests

Last modified: 2025-06-10

Content-Length: 0