Files
verse-quote-app/server/middleware/auth.ts
T

16 lines
602 B
TypeScript
Raw Normal View History

2026-07-25 17:10:38 +00:00
import { runAuthGuard } from "@agent-native/core/server";
/**
* Global auth middleware — runs for ALL requests (page routes, API routes,
* framework routes). The auth plugin configures the guard; this middleware
* enforces it on every request.
*
* Without this, auth only runs for /_agent-native/* routes because the
* framework handler's middleware registry is scoped to that catch-all.
* Page routes (/, /settings) and API routes (/api/*) would bypass auth.
*/
import { defineEventHandler } from "h3";
export default defineEventHandler(async (event) => {
return runAuthGuard(event);
});