All files / routes push.routes.ts

100% Statements 7/7
100% Branches 2/2
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21              1x   1x   1x 3x 3x 2x   1x        
// Push Routes
import { Hono } from "hono";
import { requireAuth } from "../middleware";
import { success } from "../lib/response";
 
// Note: authSessionMiddleware is applied via index.ts for /api/push/*
// contextMiddleware is NOT needed — we only access c.env
const app = new Hono<{ Bindings: CloudflareBindings }>();
 
app.use("*", requireAuth);
 
app.get("/vapid-public-key", (c) => {
	const publicKey = c.env.VAPID_PUBLIC_KEY;
	if (!publicKey) {
		return c.json({ error: "VAPID not configured" }, 500);
	}
	return success(c, { publicKey });
});
 
export default app;