adding file logic

This commit is contained in:
Ishaan Dey
2024-04-29 00:50:25 -04:00
parent 3b9aa900c8
commit bce9d11b3b
12 changed files with 208 additions and 44 deletions

View File

@ -41,7 +41,16 @@ export default {
});
} else return invalidRequest;
} else if (method === 'POST') {
return new Response('Hello, world!');
const createSchema = z.object({
fileId: z.string(),
});
const body = await request.json();
const { fileId } = createSchema.parse(body);
await env.R2.put(fileId, '');
return success;
} else return methodNotAllowed;
} else if (path === '/api/rename' && method === 'POST') {
const renameSchema = z.object({