Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(nuxt): correct api directory #12358

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dargmuesli
Copy link

DESCRIBE YOUR PR

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.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

EXTRA RESOURCES

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.
Copy link

vercel bot commented Jan 15, 2025

@dargmuesli is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

@dargmuesli
Copy link
Author

cc @TheAlexLichter, maybe you can confirm

@coolguyzone coolguyzone requested a review from s1gr1d January 16, 2025 18:57
@@ -5,7 +5,7 @@ Check out the <PlatformLink to="/install/cli-import">`--import` CLI flag</Platfo

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

```js {tabTitle:Nitro} {filename:server/sentry-example-api.ts}
```js {tabTitle:Nitro} {filename:server/api/sentry-example.ts}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't have strong opinions towards this change. Everything in the /server directory is considered "server-side" and you can add event handlers everywhere. But if it's more common to have an api folder, we can update this example and it's fine as well :)

Please make sure to update the snippet further down in the file as well:

await useFetch('/sentry-example-api');

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you can add event handlers everywhere. See this reproduction: https://stackblitz.com/edit/github-hxpfgvjj?file=app.vue

Also, $fetch should be used instead of useFetch when it is called at a time at which the component is already mounted.

In the default nuxt setup, imports from #imports are not necessary due to Nuxt's auto-imports.

Lastly, I've marked the api endpoint so that it only applies to GET requests which is considered good practice afaik as it decreases the api surface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants