14 lines
400 B
TypeScript
14 lines
400 B
TypeScript
import { withMiddlewareAuthRequired } from '@auth0/nextjs-auth0/edge';
|
|
import { NextRequest, NextResponse } from 'next/server';
|
|
|
|
export default function middleware(request: NextRequest) {
|
|
if (request.nextUrl.pathname.startsWith('/admin')) {
|
|
return withMiddlewareAuthRequired()(request, {} as never);
|
|
}
|
|
return NextResponse.next();
|
|
}
|
|
|
|
export const config = {
|
|
matcher: ['/admin/:path*'],
|
|
};
|