JavaScript Runtime APIs ⁠-⁠ AddEventListener

The addEventListener function defines the trigger for the execution of JavaScript code to receive the request data. The event listener type is fetch and gets the fetchEvent

addEventListener(type, listener)
  • type: string - the supported type is fetch.

  • listener: function - the function that handles incoming Azion Cells events.

addEventListener("fetch", event => {
return event.respondWith(
new Response("Hello world")

For more information on addEventListener visit MDN Web Docs.