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

PRO-4745: Make it possible to fetch data rather than a rendered page for any page URL in Apostrophe core #4285

Merged
merged 2 commits into from
Sep 8, 2023

Conversation

boutell
Copy link
Member

@boutell boutell commented Sep 8, 2023

Summary

See changelog.

What are the specific steps to test this change?

Sites render pages as normal.

What kind of change does this PR introduce?

(Check at least one)

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Build-related changes
  • Other

Make sure the PR fulfills these requirements:

  • It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
  • The changelog is updated
  • Related documentation has been updated: I'll ask Bob
  • Related tests have been updated

If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

@linear
Copy link

linear bot commented Sep 8, 2023

PRO-4745 Make it possible to fetch data rather than a rendered page for any page URL in Apostrophe core

smaccari has overridden our sendPage logic to send all of req.data as JSON instead if a certain header is present, and asked that this be added to the core.

This makes sense, but others may wish to do slightly different things, like pruning req.data, or sending it in another format.

https://github.com/apostrophecms/apostrophe/blob/main/modules/%40apostrophecms/module/index.js#L485-L487

So the change we will make is to factor out the line above that actually renders the page as an overridable method, and document this as a way to completely swap out the rendering pipeline for pages.

For consistency, a similar override point is desirable for the render-widget and render-area routes.

See original request: https://gitlab-dcadcx.michelin.net/pa/apostrophe-enhancements/-/issues/1218

@boutell boutell merged commit 52e4517 into main Sep 8, 2023
6 checks passed
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