middleware
middleware copied to clipboard
basicAuth for serveStatic
How can I use basicAuth for serveStatic?
import { Hono } from "hono";
import { basicAuth } from "hono/basic-auth";
import { serveStatic } from "hono/bun";
const app = new Hono();
const auth = basicAuth({
username: "password",
password: "password",
});
app.use("/*", auth);
app.use("/static/*", auth, serveStatic({ root: "./" }));
Bun.serve({ port: 8000, fetch: app.fetch });
When I hit localhost:8000/static/image.svg it gives error: script "dev" was terminated by signal SIGSEGV (Address boundary error)
It works fine with app.HTML_METHODS
@alan-khosro
What command did you run? bun run src/index.ts?