Serving static files with Byte on Bun.
// Registering routes for servingconst publicDir = `${import.meta.dir}/public/`;app.any('/*', (ctx) => ctx.body(Bun.file(publicDir + ctx.params.$))); // ServingBun.serve({ // Get the fetch function fetch: app.fetch, // Handle uncaught error, which includes file not found error: send.body(null, { status: 404 })});
Serving static files with Byte on Deno.
import { serveDir } from 'jsr:@std/http/file-server'; const serveDirOptions = { fsRoot: `${import.meta.dir}/public/` };app.any('/*', (ctx) => serveDir(ctx.req, serveDirOptions));