Skip to content

Commit adf3683

Browse files
authored
docs(nuxt): correct api directory (#12358)
* docs(nuxt): correct api directory I think this should be `server/api/*`, I've never seen event handlers directly under `server`, but feel free to correct me if I'm wrong. * docs(nuxt): improve error testing script
1 parent 7de987d commit adf3683

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

platform-includes/getting-started-verify/javascript.nuxt.mdx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ Check out the <PlatformLink to="/install/cli-import">`--import` CLI flag</Platfo
55

66
To verify that Sentry works on the server-side, add the following snippet on the server-side:
77

8-
```js {tabTitle:Nitro} {filename:server/sentry-example-api.ts}
9-
import { defineEventHandler } from '#imports';
10-
8+
```js {tabTitle:Nitro} {filename:server/api/sentry-example.get.ts}
119
export default defineEventHandler(event => {
1210
throw new Error("Sentry Example API Route Error");
1311
});
14-
1512
```
1613

1714
If you want to test server-side monitoring locally, build your project and run:
@@ -34,7 +31,6 @@ Add the following snippet on the client-side:
3431
```html {tabTitle:Vue} {filename:pages/example-error.vue}
3532
<script setup>
3633
import * as Sentry from '@sentry/nuxt';
37-
import { useFetch} from '#imports'
3834
3935
function triggerClientError() {
4036
throw new Error("Nuxt Button Error");
@@ -47,7 +43,7 @@ Add the following snippet on the client-side:
4743
op: 'test'
4844
},
4945
async () => {
50-
await useFetch('/sentry-example-api');
46+
await $fetch('/api/sentry-example');
5147
}
5248
)
5349
}
@@ -62,5 +58,3 @@ Add the following snippet on the client-side:
6258
</button>
6359
</template>
6460
```
65-
66-

0 commit comments

Comments
 (0)