vercel / next-learn

Learn Next.js Starter Code
https://next-learn-dashboard.vercel.sh/
MIT License
3.61k stars 1.86k forks source link

chapter 15, how to change the matcher #596

Open liwenz opened 6 months ago

liwenz commented 6 months ago

I hope to not protect the / and /dashboard, but protect the /protected and keep the login and logout. It should change the follow: matcher: ['/((?!api|_next/static|_next/image|.\.png$).)'], as I hope to demo the basic function and not login at first.

``import NextAuth from 'next-auth'; import { authConfig } from './auth.config';

export default NextAuth(authConfig).auth;

export const config = { // https://nextjs.org/docs/app/building-your-application/routing/middleware#matcher matcher: ['/((?!api|_next/static|_next/image|.\.png$).)'], };

delbaoliveira commented 4 months ago

Hey @liwenz, so I understand, were you trying to protect other routes?