refactor: migrate deprecated middleware convention to proxy (Next 16)
Middlewate file convention is deprecated in Next 16.3.5 (renamed to proxy). git mv middleware.ts -> proxy.ts, rename exported fn middleware -> proxy. Build now emits `ƒ Proxy (Middleware)` with no deprecation warning.
This commit is contained in:
@@ -48,4 +48,4 @@ updates:
|
|||||||
patterns: ["*"]
|
patterns: ["*"]
|
||||||
update-types:
|
update-types:
|
||||||
- "minor"
|
- "minor"
|
||||||
- "patch"
|
- "patch"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { getSessionCookie } from "better-auth/cookies";
|
|||||||
|
|
||||||
const PROTECTED_PATHS = ["/protected"];
|
const PROTECTED_PATHS = ["/protected"];
|
||||||
|
|
||||||
export function middleware(request: NextRequest) {
|
export function proxy(request: NextRequest) {
|
||||||
const { pathname } = request.nextUrl;
|
const { pathname } = request.nextUrl;
|
||||||
|
|
||||||
if (PROTECTED_PATHS.some((p) => pathname.startsWith(p))) {
|
if (PROTECTED_PATHS.some((p) => pathname.startsWith(p))) {
|
||||||
Reference in New Issue
Block a user