How can I execute shell commands in Svelte?
How can I execute shell commands in Svelte?
child-process doesn't work since it uses Node and CF doesn't support thatexport async function onRequest(context) and uses the value? Does is always act like a middleware? Would I need to route this manually like in https://developers.cloudflare.com/pages/platform/functions/examples/ab-testing/ ?_routes.json , even when using advanced mode (_worker.js), you do not need to serve static assets using env.ASSETS.fetch -- it's done for you.onRequest syntax is specific to Functions file-based routing, so whilst you could have a middleware that does routing based on the request URL, you'd rather do functions/foo.ts and functions/bar.ts.next() just falls through to the asset server if it isn't a middleware.

export async function onRequest({ request, next, env }) {
const url = new URL(request.url)
if (url.pathname === "/foo") {
return new Response("foo")
}
if (url.pathname === "/far") {
return new Response("bar")
}
return next()
}child-process