Skip to content

Commit

Permalink
Merge pull request #732 from itsmingjie/patch-1
Browse files Browse the repository at this point in the history
Fix incorrect instructions for Next.js app router
  • Loading branch information
rishabhpoddar authored Oct 23, 2023
2 parents 2de5439 + 99efd77 commit 20a83b1
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 55 deletions.
12 changes: 6 additions & 6 deletions v2/emailpassword/nextjs/app-directory/setting-up-backend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import AppInfoForm from "/src/components/appInfoForm"

We will add all the backend APIs for auth on `/api/auth`. This can be changed by setting the `apiBasePath` property in the `appInfo` object in the `appInfo.ts` file. For the rest of this page, we will assume you are using `/api/auth`.

## 1) Create the API folder
- Be sure to create the `auth` folder in the `app/api/` folder.
- `[[...path]].tsx` will use the `getAppDirRequestHandler` helper function exposed by `supertokens-node` which helps in calling all the APIs like sign in, sign up etc. (the full folder path should be `/app/api/auth/[[...path]].tsx`).
- An example of this can be found [here](https://github.com/supertokens/next.js/tree/canary/examples/with-supertokens/app/api/auth/%5B...path%5D).
## 1) Create the `app/api/auth/[[...path]]/route.ts` route
- Be sure to create the `auth/[[...path]]` folder in the `app/api/` folder.
- `route.ts` will use the `getAppDirRequestHandler` helper function exposed by `supertokens-node` which helps in calling all the APIs like sign in, sign up etc. (the full folder path should be `/app/api/auth/[[...path]]/route.ts`).
- An example of this can be found [here](https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/app/api/auth/%5B...path%5D/route.ts).

## 2) Expose the SuperTokens APIs

Expand All @@ -28,12 +28,12 @@ We will add all the backend APIs for auth on `/api/auth`. This can be changed by
showNextJSAPIRouteCheckbox
>

```tsx title="app/api/auth/[[...path]].ts"
```tsx title="app/api/auth/[[...path]]/route.ts"
declare let ensureSuperTokensInit: () => void; // typecheck-only, removed from output
import { getAppDirRequestHandler } from 'supertokens-node/nextjs';
import { NextRequest, NextResponse } from 'next/server';
// @ts-ignore
import { ensureSuperTokensInit } from '../../../config/backend';
import { ensureSuperTokensInit } from '../../../../config/backend';

ensureSuperTokensInit();

Expand Down
10 changes: 5 additions & 5 deletions v2/emailpassword/nextjs/app-directory/setting-up-frontend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import AppInfoForm from "/src/components/appInfoForm";

<PreBuiltUIContent>

## 1) Create the `app/auth/[[...path]].tsx` page
- Be sure to create the `auth` folder in the `app` folder.
- `[[...path]].tsx` will contain the component for showing SuperTokens UI
- An example of this can be found [here](https://github.com/supertokens/next.js/tree/canary/examples/with-supertokens/app/auth/%5B%5B...path%5D%5D).
## 1) Create the `app/auth/[[...path]]/page.tsx` page
- Be sure to create the `auth/[[...path]]` folder in the `app` folder.
- `page.tsx` will contain the component for showing SuperTokens UI
- An example of this can be found [here](https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/app/auth/%5B%5B...path%5D%5D/page.tsx).

## 2) Create the `Auth` component:

```tsx title="app/auth/[[...path]].tsx"
```tsx title="app/auth/[[...path]]/page.tsx"
'use client';

import { useEffect } from 'react';
Expand Down
12 changes: 6 additions & 6 deletions v2/passwordless/nextjs/app-directory/setting-up-backend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import AppInfoForm from "/src/components/appInfoForm"

We will add all the backend APIs for auth on `/api/auth`. This can be changed by setting the `apiBasePath` property in the `appInfo` object in the `appInfo.ts` file. For the rest of this page, we will assume you are using `/api/auth`.

## 1) Create the API folder
- Be sure to create the `auth` folder in the `app/api/` folder.
- `[[...path]].tsx` will use the `getAppDirRequestHandler` helper function exposed by `supertokens-node` which helps in calling all the APIs like sign in, sign up etc. (the full folder path should be `/app/api/auth/[[...path]].tsx`).
- An example of this can be found [here](https://github.com/supertokens/next.js/tree/canary/examples/with-supertokens/app/api/auth/%5B...path%5D).
## 1) Create the `app/api/auth/[[...path]]/route.ts` route
- Be sure to create the `auth/[[...path]]` folder in the `app/api/` folder.
- `route.ts` will use the `getAppDirRequestHandler` helper function exposed by `supertokens-node` which helps in calling all the APIs like sign in, sign up etc. (the full folder path should be `/app/api/auth/[[...path]]/route.ts`).
- An example of this can be found [here](https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/app/api/auth/%5B...path%5D/route.ts).

## 2) Expose the SuperTokens APIs

Expand All @@ -28,12 +28,12 @@ We will add all the backend APIs for auth on `/api/auth`. This can be changed by
showNextJSAPIRouteCheckbox
>

```tsx title="app/api/auth/[[...path]].ts"
```tsx title="app/api/auth/[[...path]]/route.ts"
declare let ensureSuperTokensInit: () => void; // typecheck-only, removed from output
import { getAppDirRequestHandler } from 'supertokens-node/nextjs';
import { NextRequest, NextResponse } from 'next/server';
// @ts-ignore
import { ensureSuperTokensInit } from '../../../config/backend';
import { ensureSuperTokensInit } from '../../../../config/backend';

ensureSuperTokensInit();

Expand Down
10 changes: 5 additions & 5 deletions v2/passwordless/nextjs/app-directory/setting-up-frontend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import AppInfoForm from "/src/components/appInfoForm";

<PreBuiltUIContent>

## 1) Create the `app/auth/[[...path]].tsx` page
- Be sure to create the `auth` folder in the `app` folder.
- `[[...path]].tsx` will contain the component for showing SuperTokens UI
- An example of this can be found [here](https://github.com/supertokens/next.js/tree/canary/examples/with-supertokens/app/auth/%5B%5B...path%5D%5D).
## 1) Create the `app/auth/[[...path]]/page.tsx` page
- Be sure to create the `auth/[[...path]]` folder in the `app` folder.
- `page.tsx` will contain the component for showing SuperTokens UI
- An example of this can be found [here](https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/app/auth/%5B%5B...path%5D%5D/page.tsx).

## 2) Create the `Auth` component:

```tsx title="app/auth/[[...path]].tsx"
```tsx title="app/auth/[[...path]]/page.tsx"
'use client';

import { useEffect } from 'react';
Expand Down
12 changes: 6 additions & 6 deletions v2/thirdparty/nextjs/app-directory/setting-up-backend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import AppInfoForm from "/src/components/appInfoForm"

We will add all the backend APIs for auth on `/api/auth`. This can be changed by setting the `apiBasePath` property in the `appInfo` object in the `appInfo.ts` file. For the rest of this page, we will assume you are using `/api/auth`.

## 1) Create the API folder
- Be sure to create the `auth` folder in the `app/api/` folder.
- `[[...path]].tsx` will use the `getAppDirRequestHandler` helper function exposed by `supertokens-node` which helps in calling all the APIs like sign in, sign up etc. (the full folder path should be `/app/api/auth/[[...path]].tsx`).
- An example of this can be found [here](https://github.com/supertokens/next.js/tree/canary/examples/with-supertokens/app/api/auth/%5B...path%5D).
## 1) Create the `app/api/auth/[[...path]]/route.ts` route
- Be sure to create the `auth/[[...path]]` folder in the `app/api/` folder.
- `route.ts` will use the `getAppDirRequestHandler` helper function exposed by `supertokens-node` which helps in calling all the APIs like sign in, sign up etc. (the full folder path should be `/app/api/auth/[[...path]]/route.ts`).
- An example of this can be found [here](https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/app/api/auth/%5B...path%5D/route.ts).

## 2) Expose the SuperTokens APIs

Expand All @@ -28,12 +28,12 @@ We will add all the backend APIs for auth on `/api/auth`. This can be changed by
showNextJSAPIRouteCheckbox
>

```tsx title="app/api/auth/[[...path]].ts"
```tsx title="app/api/auth/[[...path]]/route.ts"
declare let ensureSuperTokensInit: () => void; // typecheck-only, removed from output
import { getAppDirRequestHandler } from 'supertokens-node/nextjs';
import { NextRequest, NextResponse } from 'next/server';
// @ts-ignore
import { ensureSuperTokensInit } from '../../../config/backend';
import { ensureSuperTokensInit } from '../../../../config/backend';

ensureSuperTokensInit();

Expand Down
10 changes: 5 additions & 5 deletions v2/thirdparty/nextjs/app-directory/setting-up-frontend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import AppInfoForm from "/src/components/appInfoForm";

<PreBuiltUIContent>

## 1) Create the `app/auth/[[...path]].tsx` page
- Be sure to create the `auth` folder in the `app` folder.
- `[[...path]].tsx` will contain the component for showing SuperTokens UI
- An example of this can be found [here](https://github.com/supertokens/next.js/tree/canary/examples/with-supertokens/app/auth/%5B%5B...path%5D%5D).
## 1) Create the `app/auth/[[...path]]/page.tsx` page
- Be sure to create the `auth/[[...path]]` folder in the `app` folder.
- `page.tsx` will contain the component for showing SuperTokens UI
- An example of this can be found [here](https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/app/auth/%5B%5B...path%5D%5D/page.tsx).

## 2) Create the `Auth` component:

```tsx title="app/auth/[[...path]].tsx"
```tsx title="app/auth/[[...path]]/page.tsx"
'use client';

import { useEffect } from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import AppInfoForm from "/src/components/appInfoForm"

We will add all the backend APIs for auth on `/api/auth`. This can be changed by setting the `apiBasePath` property in the `appInfo` object in the `appInfo.ts` file. For the rest of this page, we will assume you are using `/api/auth`.

## 1) Create the API folder
- Be sure to create the `auth` folder in the `app/api/` folder.
- `[[...path]].tsx` will use the `getAppDirRequestHandler` helper function exposed by `supertokens-node` which helps in calling all the APIs like sign in, sign up etc. (the full folder path should be `/app/api/auth/[[...path]].tsx`).
- An example of this can be found [here](https://github.com/supertokens/next.js/tree/canary/examples/with-supertokens/app/api/auth/%5B...path%5D).
## 1) Create the `app/api/auth/[[...path]]/route.ts` route
- Be sure to create the `auth/[[...path]]` folder in the `app/api/` folder.
- `route.ts` will use the `getAppDirRequestHandler` helper function exposed by `supertokens-node` which helps in calling all the APIs like sign in, sign up etc. (the full folder path should be `/app/api/auth/[[...path]]/route.ts`).
- An example of this can be found [here](https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/app/api/auth/%5B...path%5D/route.ts).

## 2) Expose the SuperTokens APIs

Expand All @@ -28,12 +28,12 @@ We will add all the backend APIs for auth on `/api/auth`. This can be changed by
showNextJSAPIRouteCheckbox
>

```tsx title="app/api/auth/[[...path]].ts"
```tsx title="app/api/auth/[[...path]]/route.ts"
declare let ensureSuperTokensInit: () => void; // typecheck-only, removed from output
import { getAppDirRequestHandler } from 'supertokens-node/nextjs';
import { NextRequest, NextResponse } from 'next/server';
// @ts-ignore
import { ensureSuperTokensInit } from '../../../config/backend';
import { ensureSuperTokensInit } from '../../../../config/backend';

ensureSuperTokensInit();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import AppInfoForm from "/src/components/appInfoForm";

<PreBuiltUIContent>

## 1) Create the `app/auth/[[...path]].tsx` page
- Be sure to create the `auth` folder in the `app` folder.
- `[[...path]].tsx` will contain the component for showing SuperTokens UI
- An example of this can be found [here](https://github.com/supertokens/next.js/tree/canary/examples/with-supertokens/app/auth/%5B%5B...path%5D%5D).
## 1) Create the `app/auth/[[...path]]/page.tsx` page
- Be sure to create the `auth/[[...path]]` folder in the `app` folder.
- `page.tsx` will contain the component for showing SuperTokens UI
- An example of this can be found [here](https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/app/auth/%5B%5B...path%5D%5D/page.tsx).

## 2) Create the `Auth` component:

```tsx title="app/auth/[[...path]].tsx"
```tsx title="app/auth/[[...path]]/page.tsx"
'use client';

import { useEffect } from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import AppInfoForm from "/src/components/appInfoForm"

We will add all the backend APIs for auth on `/api/auth`. This can be changed by setting the `apiBasePath` property in the `appInfo` object in the `appInfo.ts` file. For the rest of this page, we will assume you are using `/api/auth`.

## 1) Create the API folder
- Be sure to create the `auth` folder in the `app/api/` folder.
- `[[...path]].tsx` will use the `getAppDirRequestHandler` helper function exposed by `supertokens-node` which helps in calling all the APIs like sign in, sign up etc. (the full folder path should be `/app/api/auth/[[...path]].tsx`).
- An example of this can be found [here](https://github.com/supertokens/next.js/tree/canary/examples/with-supertokens/app/api/auth/%5B...path%5D).
## 1) Create the `app/api/auth/[[...path]]/route.ts` route
- Be sure to create the `auth/[[...path]]` folder in the `app/api/` folder.
- `route.ts` will use the `getAppDirRequestHandler` helper function exposed by `supertokens-node` which helps in calling all the APIs like sign in, sign up etc. (the full folder path should be `/app/api/auth/[[...path]]/route.ts`).
- An example of this can be found [here](https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/app/api/auth/%5B...path%5D/route.ts).

## 2) Expose the SuperTokens APIs

Expand All @@ -28,12 +28,12 @@ We will add all the backend APIs for auth on `/api/auth`. This can be changed by
showNextJSAPIRouteCheckbox
>

```tsx title="app/api/auth/[[...path]].ts"
```tsx title="app/api/auth/[[...path]]/route.ts"
declare let ensureSuperTokensInit: () => void; // typecheck-only, removed from output
import { getAppDirRequestHandler } from 'supertokens-node/nextjs';
import { NextRequest, NextResponse } from 'next/server';
// @ts-ignore
import { ensureSuperTokensInit } from '../../../config/backend';
import { ensureSuperTokensInit } from '../../../../config/backend';

ensureSuperTokensInit();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import AppInfoForm from "/src/components/appInfoForm";

<PreBuiltUIContent>

## 1) Create the `app/auth/[[...path]].tsx` page
- Be sure to create the `auth` folder in the `app` folder.
- `[[...path]].tsx` will contain the component for showing SuperTokens UI
- An example of this can be found [here](https://github.com/supertokens/next.js/tree/canary/examples/with-supertokens/app/auth/%5B%5B...path%5D%5D).
## 1) Create the `app/auth/[[...path]]/page.tsx` page
- Be sure to create the `auth/[[...path]]` folder in the `app` folder.
- `page.tsx` will contain the component for showing SuperTokens UI
- An example of this can be found [here](https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/app/auth/%5B%5B...path%5D%5D/page.tsx).

## 2) Create the `Auth` component:

```tsx title="app/auth/[[...path]].tsx"
```tsx title="app/auth/[[...path]]/page.tsx"
'use client';

import { useEffect } from 'react';
Expand Down

0 comments on commit 20a83b1

Please sign in to comment.