frontend / middleware.ts
praneethys's picture
login screen (#5)
a6ff428 verified
raw
history blame contribute delete
No virus
729 Bytes
import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'
// This function can be marked `async` if using `await` inside
export function middleware(request: NextRequest) {
if (request.nextUrl.pathname === '/') {
return NextResponse.redirect(new URL('/login', request.url))
}
return NextResponse.next();
}
// Ensure the middleware is only called for relevant paths.
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
*/
'/((?!_next/static|_next/image|auth|monitoring|svgs|favicon.ico).*)',
],
};