Files
supabase/examples/auth/nextjs
Khalifa Fumo 1b97e659e0 Update middleware.ts to check if user is logged in
I was experiencing an issue where I could not protect my routes within my Next.js 13 (app) app. I searched for a fix everywhere but the app router being a new development, I did not find any help, even within the supabase docs, so I set out to trying a fix for myself and I found this to work perfectly. You can now protect your routes such that only logged in users can access some pages. You can also configure the config such that the middleware is set to run (or not to run) on selected pages.
2023-05-14 18:28:20 +03:00
..
2023-03-15 20:27:17 +11:00
2023-03-15 20:27:17 +11:00
2023-03-15 20:27:17 +11:00
2023-03-15 20:27:17 +11:00
2023-03-15 20:27:17 +11:00
2023-03-15 20:27:17 +11:00
2023-03-15 20:27:17 +11:00
2023-03-15 20:27:17 +11:00
2023-03-15 20:27:17 +11:00
2023-03-15 20:27:17 +11:00

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in app/api/hello.ts.

The app/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

This project uses next/font to automatically optimize and load Inter, a custom Google Font.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.