JavaScript Runtime APIs - FetchEvent
How it works
FetchEvent is the event that passes the request through the addEventListener function. The addEventListener, in turn, defines the trigger for executing the JavaScript code and receives the request data.
Syntax
Properties
event.type: fetch
event.request: request
- the HTTP request received by the Edge Function.
Methods
When the Edge Function receives a request, the Runtime executes the FetchEvent, which can be manipulated by the eventListener of a fetch
type that, in turn, can call the method that defines what will happen until the response:
Example
For more information on fetchEvent visit MDN Web Docs.