Class: HandleCorsMiddleware
Class: HandleCorsMiddleware
Kernel Middleware for adding Cross-Origin Resource Sharing (CORS) headers to HTTP responses. It allows controlling how clients from different origins can access the server's resources.
Template
Represents the type of the incoming HTTP event.
Template
Represents the type of the outgoing HTTP response.
Author
Mr. Stone evensstone@gmail.com
Constructors
Constructor
new HandleCorsMiddleware(blueprint): HandleCorsMiddleware;
Construct an instance of HandleCorsMiddleware.
Parameters
blueprint
The configuration blueprint used for managing CORS settings.
blueprint
IBlueprint
Returns
HandleCorsMiddleware
Methods
handle()
handle(event, next): Promise<OutgoingHttpResponse>;
Handle CORS by modifying the response headers based on the configuration.
Parameters
event
The incoming HTTP event.
next
NextMiddleware
<IncomingHttpEvent
, OutgoingHttpResponse
>
The next middleware function to continue processing the event.
Returns
Promise
<OutgoingHttpResponse
>
The outgoing HTTP response with CORS headers.