Pular para o conteúdo

Fetch Handler

Atualizado em Ver como Markdown

Background

Incoming HTTP requests to a Worker are passed to the fetch() handler as a Request object. To respond to the request with a response, return a Response object:

export default {
	async fetch(request, env, ctx) {
		return new Response('Hello World!');
	},
};

Parameters

  • request Request

    • The incoming HTTP request.
  • env object

  • ctx.waitUntil(promisePromise) : void

  • ctx.passThroughOnException() : void