cors
CORS (Cross-Origin Resource Sharing) middleware for handling cross-origin requests in Buntal applications.
Source
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
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
options | CorsOptions | ❌ | - | CORS configuration options | 
Properties
| Property | Type | Required | Default | Description | 
|---|---|---|---|---|
origin | string | string[] | ❌ | * | Allowed origins for cross-origin requests | 
methods | string | string[] | ❌ | GET, HEAD, PUT, PATCH, POST, DELETE | Allowed HTTP methods | 
allowedHeaders | string | string[] | ❌ | Content-Type, Authorization, X-Requested-With | Allowed request headers | 
exposedHeaders | string | string[] | ❌ | - | Headers exposed to the client | 
maxAge | number | ❌ | 600 | Preflight request cache duration in seconds | 
credentials | boolean | ❌ | true | Whether to include credentials in CORS requests | 
Last modified: 2025-06-10