Skip to content

Commit

Permalink
docs(route-handlers): add typescript/javascript switcher to route-han…
Browse files Browse the repository at this point in the history
…dlers.mdx

- Added a TypeScript/JavaScript switcher to the `route-handlers.mdx` documentation file to allow users to easily switch between the code examples for both languages.
  • Loading branch information
arfa123 authored Nov 2, 2024
1 parent 13fafe6 commit 0627459
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,17 @@ You can consider a `route` the lowest level routing primitive.

Each `route.js` or `page.js` file takes over all HTTP verbs for that route.

```jsx filename="app/page.js"
```ts filename="app/page.ts" switcher
export default function Page() {
return <h1>Hello, Next.js!</h1>
}

// ❌ Conflict
// `app/route.ts`
export async function POST(request) {}
```

```js filename="app/page.js" switcher
export default function Page() {
return <h1>Hello, Next.js!</h1>
}
Expand Down

0 comments on commit 0627459

Please sign in to comment.