Skip to content

Commit

Permalink
feat: make guestbook endpoint avaiable to signed out users
Browse files Browse the repository at this point in the history
  • Loading branch information
ixartz committed Oct 24, 2023
1 parent bbdda73 commit 10b4d81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/middleware.ts
Expand Up @@ -4,6 +4,10 @@ import type { NextRequest } from 'next/server';
export default authMiddleware({
publicRoutes: (req: NextRequest) =>
!req.nextUrl.pathname.startsWith('/dashboard'),
ignoredRoutes: ['/api/guestbook'],
// By default, the middleware will return a 401 response for all routes `/api/*` when the user is signed out.
// But, for `/api/guestbook`, we want unauthenticated users to be able to access it.

// eslint-disable-next-line consistent-return
afterAuth(auth, req) {
// handle users who aren't authenticated
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/Guestbook.spec.ts
@@ -1,7 +1,5 @@
import { expect, test } from '@playwright/test';

test.use({ userAgent: '' });

test.describe('Guestbook', () => {
test.describe('Basic CRUD operations', () => {
test('should create a new entry in the guestbook and delete it', async ({
Expand Down

0 comments on commit 10b4d81

Please sign in to comment.