Skip to content

Commit 58b1e7e

Browse files
Remove suggestion to put elysia in the top level app folder
1 parent cd536a8 commit 58b1e7e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/integrations/nextjs.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ head:
1818

1919
With Nextjs App Router, we can run Elysia on Nextjs route.
2020

21-
1. Create **[[...slugs]]/route.ts** inside app router
21+
1. Create **api/[[...slugs]]/route.ts** inside app router
2222
2. In **route.ts**, create or import an existing Elysia server
2323
3. Export the handler with the name of method you want to expose
2424

2525
```typescript
2626
// app/[[...slugs]]/route.ts
27-
const app = new Elysia()
27+
const app = new Elysia({ prefix: '/api' })
2828
.get('/', () => 'hello Next')
2929
.post('/', ({ body }) => body, {
3030
body: t.Object({
@@ -46,13 +46,13 @@ Please refer to [Nextjs Route Handlers](https://nextjs.org/docs/app/building-you
4646

4747
## Prefix
4848

49-
If you place an Elysia server not in the root directory of the app router, you need to annotate the prefix to the Elysia server.
49+
Because our Elysia server is not in the root directory of the app router, you need to annotate the prefix to the Elysia server.
5050

51-
For example, if you place Elysia server in **app/api/[[...slugs]]/route.ts**, you need to annotate prefix as **/api** to Elysia server.
51+
For example, if you place Elysia server in **app/user/[[...slugs]]/route.ts**, you need to annotate prefix as **/user** to Elysia server.
5252

5353
```typescript{2}
5454
// app/api/[[...slugs]]/route.ts
55-
const app = new Elysia({ prefix: '/api' })
55+
const app = new Elysia({ prefix: '/user' })
5656
.get('/', () => 'hi')
5757
.post('/', ({ body }) => body, {
5858
body: t.Object({

0 commit comments

Comments
 (0)