From 6831b921697ce6f0a3819de9a9a4529f5f8b1117 Mon Sep 17 00:00:00 2001 From: seaznCode Date: Mon, 1 Dec 2025 21:15:41 +0100 Subject: [PATCH] add comment for functionality explanation --- middleware.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/middleware.ts b/middleware.ts index 66921a7..6d72d89 100644 --- a/middleware.ts +++ b/middleware.ts @@ -1,3 +1,9 @@ +/** + * Next.js middleware to protect admin routes. + * - Runs for paths matched by the config `matcher` (see bottom). + * - Checks for the `refreshToken` cookie; if missing, redirects to `/login` before any page renders. + * - No manual import/use needed—Next.js automatically executes this for matching requests. + */ import { NextRequest, NextResponse } from 'next/server' // Move accessToken to HttpOnly cookie in future for better security