Skip to content

Commit e2e1556

Browse files
Delete API route handler section as it breaks compilation
1 parent b8fa696 commit e2e1556

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

articles/quickstart/webapp/nextjs/01-login.md

-37
Original file line numberDiff line numberDiff line change
@@ -195,43 +195,6 @@ export default async function ProfileServer() {
195195
Verify that you can display the `user.name` or <a href="https://auth0.com/docs/users/user-profile-structure#user-profile-attributes" target="_blank" rel="noreferrer">any other</a> `user` property within a component correctly after you have logged in.
196196
:::
197197

198-
### Create custom routes using the dynamic API route handler
199-
200-
Create the file at `app/api/shows/route.js`. This is your route Handler file using <a href="https://nextjs.org/docs/app/building-your-application/routing/route-handlers#dynamic-route-segments" target="_blank" rel="noreferrer">Dynamic Route Segment</a>. The file declares a `GET` export to call the `shows()` method from the SDK to create custom API routes. import the `handleAuth` method from the SDK and call it from the `GET` export.
201-
202-
```javascript
203-
// app/api/shows/route.js
204-
import { NextResponse } from 'next/server';
205-
import { auth0 } from '../../../lib/auth0';
206-
207-
export const GET = async function shows() {
208-
try {
209-
const session = await auth0.getSession();
210-
211-
if (!session) {
212-
return NextResponse.json(
213-
{ error: 'Not authenticated' },
214-
{ status: 401 }
215-
);
216-
}
217-
218-
const res = new NextResponse();
219-
const { token: accessToken } = await auth0.getAccessToken();
220-
const apiPort = process.env.API_PORT || 3001;
221-
const response = await fetch(`http://localhost:${apiPort}/api/shows`, {
222-
headers: {
223-
Authorization: `Bearer ${accessToken}`
224-
}
225-
});
226-
const shows = await response.json();
227-
228-
return NextResponse.json(shows, res);
229-
} catch (error) {
230-
return NextResponse.json({ error: error.message }, { status: error.status || 500 });
231-
}
232-
};
233-
```
234-
235198
## What's next?
236199

237200
We put together a few <a href="https://github.com/auth0/nextjs-auth0/blob/main/EXAMPLES.md" target="_blank" rel="noreferrer">examples</a> on how to use <a href="https://github.com/auth0/nextjs-auth0" target="_blank" rel="noreferrer">nextjs-auth0</a> for more advanced use cases.

0 commit comments

Comments
 (0)