import { Hono } from "hono";
import { HTTPException } from "hono/http-exception";
import { jwt } from "hono/jwt";
export type Bindings = {
[key in keyof CloudflareBindings]: CloudflareBindings[key];
};
const app = new Hono<{ Bindings: Bindings }>().basePath("/v1");
app.use("*", (c, next) => {
const jwtMiddleware = jwt({
secret: c.env.CLERK_JWT_SECRET,
alg: "RS256",
});
return jwtMiddleware(c, next);
});
app.get("/", (c) => {
throw new HTTPException(401, { message: "Unauthorized" });
return c.text("Hello Hono!");
});
export default app;
import { Hono } from "hono";
import { HTTPException } from "hono/http-exception";
import { jwt } from "hono/jwt";
export type Bindings = {
[key in keyof CloudflareBindings]: CloudflareBindings[key];
};
const app = new Hono<{ Bindings: Bindings }>().basePath("/v1");
app.use("*", (c, next) => {
const jwtMiddleware = jwt({
secret: c.env.CLERK_JWT_SECRET,
alg: "RS256",
});
return jwtMiddleware(c, next);
});
app.get("/", (c) => {
throw new HTTPException(401, { message: "Unauthorized" });
return c.text("Hello Hono!");
});
export default app;