Handlers

Azion Edge Functions supports JavaScript handlers. Handler functions let you control how your edge logic manages incoming requests, applies security rules, and interacts with the runtime environment. You can define handler functions by using either the ES Modules pattern or the Service Worker syntax. With Javascript Handlers you can:

  • Respond to fetch (HTTP request) events.
  • Apply firewall and access control logic.
  • Perform asynchronous operations during request processing.
export default {
async fetch(request, env, ctx) {
return new Response('Hello World!');
},
};

Parameters:

ParameterTypeDescription
requestRequestHTTP request object
envObjectEnvironment variables and bindings
ctxObjectExecution context
ctx.waitUntil(promise)FunctionExtends the worker’s lifetime