mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
refactor(docs): note for NuxtLink usage, added geist font in example, minor cleanups
This commit is contained in:
@@ -189,7 +189,7 @@ export default defineEventHandler(async (event) => {
|
||||
```
|
||||
|
||||
<Callout type="warning">
|
||||
This can't be done in the `/server/api` directory as it will collide with the API endpoints created by the middleware. We will use [defineEventHandler](https://nuxt.com/docs/4.x/directory-structure/server) in the [/server/routes](https://nuxt.com/docs/4.x/directory-structure/server) directory to create endpoints and use them in conjunction with composables to access the API safely.
|
||||
This can't be done in the `server/api` directory as it will collide with the API endpoints created by the middleware. We will use [defineEventHandler](https://nuxt.com/docs/4.x/directory-structure/server) in the [server/routes](https://nuxt.com/docs/4.x/directory-structure/server) directory to create endpoints and use them in conjunction with composables to access the API safely.
|
||||
</Callout>
|
||||
|
||||
|
||||
@@ -385,4 +385,18 @@ onMounted(() => {
|
||||
</template>
|
||||
```
|
||||
|
||||
## Important Note
|
||||
|
||||
Use `external` attribute on Nuxt links, anytime you are traversing to an external route (like `/api/*` which are handled by bknd's middleware) to prevent vue router from intercepting the link.
|
||||
|
||||
```vue
|
||||
<NuxtLink external href="/admin">
|
||||
Admin
|
||||
</NuxtLink>
|
||||
```
|
||||
|
||||
<Callout type="error">
|
||||
If you don't use the `external` attribute, vue router will intercept the link and try to navigate to it, which will fail and result in a 404 error.
|
||||
</Callout>
|
||||
|
||||
Check the [Nuxt repository example](https://github.com/bknd-io/bknd/tree/main/examples/nuxt) for more implementation details.
|
||||
Reference in New Issue
Block a user