Best way to serve static assets using hono?
I want to create an endpoint (for ex endpoint.com/script.js) that serves a script file.
right now, im returning the contents of the file directly by
i was wondering if there was an easier way to directly serve the static file by name
2 Replies
Take a look at the Hono docs for serving static assets using Workers Assets: https://hono.dev/docs/getting-started/cloudflare-workers#serve-static-files
Cloudflare Workers - Hono
Web framework built on Web Standards for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Node.js, and others. Fast, but not only fast.
if I can piggyback on this question: is it possible to set
Cache-Control
headers on these static assets? (in the code, not through the cloudflare dashboard)