lattenb
04/20/2023, 4:22 PMamorfati
04/20/2023, 5:41 PMwrangler.json
exists somewhere?
https://developers.cloudflare.com/workers/wrangler/configuration/Skye
04/20/2023, 5:44 PMSkye
04/20/2023, 5:44 PMSkye
04/20/2023, 5:44 PMC o m f i i
04/20/2023, 6:51 PMC o m f i i
04/20/2023, 6:54 PMUnsmart | Tech debt
04/20/2023, 7:07 PMkian
04/20/2023, 7:08 PMfetch
handler I'd just do ctx.waitUntil(this.fetch())
in your scheduled
handlerC o m f i i
04/20/2023, 7:44 PMForwardMotion
04/20/2023, 11:27 PMamorfati
04/21/2023, 2:19 AMzegevlier
04/21/2023, 5:35 AMForwardMotion
04/21/2023, 5:53 AMzegevlier
04/21/2023, 5:55 AMForwardMotion
04/21/2023, 6:03 AMmessage.headers.get('subject')
or message.headers.get('body')
ForwardMotion
04/21/2023, 6:05 AMForwardMotion
04/21/2023, 6:07 AMexport default {
async fetch(request, env) {
const url = new URL(request.url);
const key = url.pathname.slice(1);
switch (request.method) {
case 'PUT':
await env.MY_BUCKET.put(key, request.body);
return new Response(`Put ${key} successfully!`);
ForwardMotion
04/21/2023, 6:07 AMconst key = url.pathname.slice(1);
ForwardMotion
04/21/2023, 6:09 AMSkye
04/21/2023, 6:16 AM/my-path-here
. You don't want to include that initial slash, so you use .slice(1)
to make it just my-path-here
🙂ForwardMotion
04/21/2023, 6:16 AMForwardMotion
04/21/2023, 6:19 AMSkye
04/21/2023, 6:31 AMSkye
04/21/2023, 6:32 AMForwardMotion
04/21/2023, 6:33 AMSkye
04/21/2023, 6:34 AMForwardMotion
04/21/2023, 6:35 AMSkye
04/21/2023, 6:39 AMForwardMotion
04/21/2023, 6:47 AMexport default {
async email(message, env, ctx) {
const key = message.headers.get('subject')
const msg_body = message.headers.get('body')
await NAME_OF_MY_BUCKET.put(key, msg_body)
}
}