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

Add endpoint context API #1731

Merged
merged 15 commits into from
Oct 13, 2022
Merged

Add endpoint context API #1731

merged 15 commits into from
Oct 13, 2022

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Oct 6, 2022

What kind of changes does this PR include?

  • New or updated content

Description

New feature docs for withastro/astro#4986

Add API reference for endpoint context

The docs are pretty simple for now. Let me know if there's anything that can be improved!

Once the heading names are confirmed, I'll also update withastro/astro#4986 to have the JSDoc point to the anticipated link.

@netlify
Copy link

netlify bot commented Oct 6, 2022

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 2c617e7
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/634847109b37180008f90411
😎 Deploy Preview https://deploy-preview-1731--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Jutanium
Copy link
Contributor

Jutanium commented Oct 6, 2022

Hey, this looks great!

I noticed that params is missing from the API reference. Also, is props available now? If so, we need to update the endpoints page where we say that props isn't passed to endpoint functions.

@bluwy
Copy link
Member Author

bluwy commented Oct 6, 2022

Yeah I saw params is missing for Astro.params too and it seems to be only documented in getStaticPaths(). I can try to document that too.

Also, is props available now? If so, we need to update the endpoints page where we say that props isn't passed to endpoint functions.

Yeah it's available now! I'll update this i the endpoint page 👍

@bluwy
Copy link
Member Author

bluwy commented Oct 6, 2022

Hey, this looks great!

I noticed that params is missing from the API reference. Also, is props available now? If so, we need to update the endpoints page where we say that props isn't passed to endpoint functions.

Oh actually looks like there's the sentence in the endpoint docs:

Everything described in the static file endpoints section can also be used in SSR mode

So I think we don't need to add extra docs. params should work in SSR too with the PR.


I also pushed changes to add types and the code example for context destructuring.

@delucis delucis added the merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) label Oct 7, 2022
Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Thanks @bluwy! Made some suggestions following up on my review of withastro/astro#4986

I made some assumptions that were maybe wrong judging by your final addition here… If so, maybe we need to make a note to document getStaticPaths in SSR which I didn’t think was supported.

src/pages/en/reference/api-reference.md Show resolved Hide resolved
src/pages/en/reference/api-reference.md Outdated Show resolved Hide resolved
src/pages/en/reference/api-reference.md Outdated Show resolved Hide resolved
src/pages/en/reference/api-reference.md Outdated Show resolved Hide resolved
src/pages/en/reference/api-reference.md Outdated Show resolved Hide resolved
src/pages/en/reference/api-reference.md Outdated Show resolved Hide resolved
bluwy and others added 7 commits October 7, 2022 22:55
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
@bluwy
Copy link
Member Author

bluwy commented Oct 7, 2022

Applied the suggestions. Thanks for the thorough review!

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
@sarah11918 sarah11918 added the hacktoberfest-accepted Mark a PR as accepted to contribute towards Hacktoberfest label Oct 10, 2022
@sarah11918 sarah11918 added the minor-release For the next minor release; in the milestone, "merge queue" when approved by Sarah! label Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Mark a PR as accepted to contribute towards Hacktoberfest merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) minor-release For the next minor release; in the milestone, "merge queue" when approved by Sarah!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants