Initial commit from agent-native create
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
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);
|
||||
});
|
||||
Reference in New Issue
Block a user