You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. In **route.ts**, create or import an existing Elysia server
23
23
3. Export the handler with the name of method you want to expose
24
24
25
25
```typescript
26
-
//apps/[...slugs]/routes.ts
26
+
//app/[[...slugs]]/route.ts
27
27
const app =newElysia()
28
28
.get('/', () =>'hello Next')
29
29
.post('/', ({ body }) =>body, {
@@ -45,12 +45,13 @@ With this approach, you can have co-location of both frontend and backend in a s
45
45
Please refer to [Nextjs Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers#static-route-handlers) for more information.
46
46
47
47
## Prefix
48
+
48
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
50
50
-
For example, if you place Elysia server in **apps/api/[...slugs]/routes.ts**, you need to annotate prefix as **/api** to Elysia server.
51
+
For example, if you place Elysia server in **app/api/[[...slugs]]/route.ts**, you need to annotate prefix as **/api** to Elysia server.
0 commit comments