forked from ananyaa0518/resQAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmiddleware.js
More file actions
30 lines (25 loc) · 869 Bytes
/
middleware.js
File metadata and controls
30 lines (25 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { NextResponse } from "next/server";
export function middleware(request) {
const { pathname } = request.nextUrl;
// Public routes that don't require authentication
const publicRoutes = ["/", "/login", "/register", "/about"];
// Check if the current route is public
if (publicRoutes.includes(pathname)) {
return NextResponse.next();
}
// For protected routes, let the client-side ProtectedRoute component handle the logic
// This middleware just allows the request to proceed
return NextResponse.next();
}
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - api (API routes)
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
*/
"/((?!api|_next/static|_next/image|favicon.ico).*)",
],
};