Skip to content

Add endpoint context API#1731

Merged
sarah11918 merged 15 commits intomainfrom
endpoint-context-api
Oct 13, 2022
Merged

Add endpoint context API#1731
sarah11918 merged 15 commits intomainfrom
endpoint-context-api

Conversation

@bluwy
Copy link
Copy Markdown
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
Copy Markdown

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

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
Copy Markdown
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" = approved for merging on release day. 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" = approved for merging on release day.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants