Netlify function to Cloudflare Pages function

Is there an equivalent function in Cloudflare Pages as Netlify function
event.queryStringParameters.query and
Found some reference but is for Cloudflare Workers.

addEventListener('fetch', event => {

async function handleRequest (request) {
  const { search, pathname } = new URL(request.url)


Thanks in advance.

request is available in Pages Functions too, so you can still do things like const url = new URL(request.url). You’ll then be able to hit url.searchParams.get('page'), etc. Workers and Pages follow web standards closely, so the usual best place for technical documentation is something like MDN.


export async function onRequestGet(context) {
	const url = new URL(context.request.url);
	const page = url.searchParams.get('page');
	// etc.
	return new Response("Hello, world!");

For more info:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.