MCPcopy Create free account
hub / github.com/Codehagen/Badget / middleware

Function middleware

src/middleware.ts:4–12  ·  view source on GitHub ↗
(request: NextRequest)

Source from the content-addressed store, hash-verified

2import { getSessionCookie } from "better-auth/cookies";
3
4export async function middleware(request: NextRequest) {
5 const sessionCookie = getSessionCookie(request);
6
7 if (!sessionCookie) {
8 return NextResponse.redirect(new URL("/sign-in", request.url));
9 }
10
11 return NextResponse.next();
12}
13
14export const config = {
15 matcher: ["/dashboard"], // Apply middleware to specific routes

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected