cloudflare--workers-sdk
70bf21e064
Prerelease / build (push) Has been skipped
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
21 行
487 B
JavaScript
21 行
487 B
JavaScript
export default {
|
|
async fetch(request, env) {
|
|
const id = `e2e-${crypto.randomUUID().slice(0, 8)}`;
|
|
|
|
// Create an instance within the default namespace
|
|
await env.AI_SEARCH_NS.create({
|
|
id,
|
|
type: "r2",
|
|
source: env.R2_BUCKET_NAME,
|
|
});
|
|
|
|
// Get instance info
|
|
const info = await env.AI_SEARCH_NS.get(id).info();
|
|
|
|
// Clean up - delete the instance
|
|
await env.AI_SEARCH_NS.delete(id);
|
|
|
|
return new Response(JSON.stringify({ created: true, info, deleted: true }));
|
|
},
|
|
};
|