Skip to content

Commit

Permalink
Fix app router API example (#1475)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjmcgrath authored Oct 5, 2023
2 parents 44b1c0f + a7867a7 commit aa61fd6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ Requests to `/api/protected` without a valid session cookie will fail with `401`
// app/api/protected/route.js
import { withApiAuthRequired, getSession } from '@auth0/nextjs-auth0';

export default withApiAuthRequired(async function myApiRoute(req) {
export const GET = withApiAuthRequired(async function myApiRoute(req) {
const res = new NextResponse();
const { user } = await getSession(req, res);
return NextResponse.json({ protected: 'My Secret', id: user.sub }, res);
Expand Down

0 comments on commit aa61fd6

Please sign in to comment.