simplest static asset hosting
So, I read through https://github.com/cloudflare/workers-sdk/issues/1162 and it was closed due to the
I'm curious about that answer regardless of whether this is actually the right solution (this is phrased an intentional XY problem), but backing up to give the context as well: I'm hosting discord bots on Workers and am trying to figure out the simplest way (to make a minimal template) to include more than 1MB of assets that they can access (the 25MB/file KV limit is fine here; would attach R2 for anything larger, I get that part). That I can tell, the methods that let you just have a directory in your repo whose contents are autodeployed are:
wrangler deploy --assets flag existing; do we have any actual documentation about how that works? Can it be used to host assets for a worker or is it just for using a worker to only host static assets?I'm curious about that answer regardless of whether this is actually the right solution (this is phrased an intentional XY problem), but backing up to give the context as well: I'm hosting discord bots on Workers and am trying to figure out the simplest way (to make a minimal template) to include more than 1MB of assets that they can access (the 25MB/file KV limit is fine here; would attach R2 for anything larger, I get that part). That I can tell, the methods that let you just have a directory in your repo whose contents are autodeployed are:
- Use
@cloudflare/kv-asset-handleras per https://developers.cloudflare.com/workers/configuration/sites/start-from-worker/. Works, boilerplate-y. - Actually deploy a pages site with one function instead of a worker; have the worker
a relative path. Works, feels kind of silly?fetch - Deploy your folder of static assets as a separate static pages site and fetch that site from your worker, hardcoding the .pages.dev domain (I actually did this one because I was lazy and I knew it would work).
- Something else? Is that what the
--assetsflag does? What's this I hear about an ASSETS binding; is that only for pages?