Cerces / middleware/cors / createCORSMiddleware
Function: createCORSMiddleware()
createCORSMiddleware(
options?):Middleware
Defined in: src/middleware/cors.ts:10
Creates a middleware that handles CORS (Cross-Origin Resource Sharing) for incoming requests. It sets appropriate CORS headers based on the provided options and handles preflight requests.
Parameters
options?
Configuration options for CORS handling.
origin
string | string[] | (origin) => undefined | null | string
allowMethods?
string[]
allowHeaders?
string[]
maxAge?
number
credentials?
boolean
exposeHeaders?
string[]
Returns
A Middleware instance that manages CORS for incoming requests.