docs(static-files): document before/after handler ordering#562
docs(static-files): document before/after handler ordering#562dawsontoth wants to merge 3 commits into
Conversation
The static handler runs before authentication (and therefore before REST) by default, so the documented SPA recipe - notFound + fallthrough: false - answered GETs for exported REST resources with index.html, making the API unreachable over GET. Documents the new before/after ordering options (HarperFast/harper#1574): a Handler Ordering section explaining the default position and the after: 'rest' recipe, ordering notes on the notFound option and the custom-404 example, a corrected SPA example, and a pointer to hash-based routing as the version-independent alternative. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request updates the static files documentation to cover the new before and after handler ordering options introduced in v5.2.0, including a new section on handler ordering and updated SPA client-side routing examples. The review feedback focuses on improving clarity and technical accuracy, such as replacing colloquial terms like 'answers' with more standard terminology, and resolving a potential inconsistency regarding whether configuration changes require a restart.
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-562 This preview will update automatically when you push new commits. |
…tically Matches HarperFast/harper#1574, which now requests a component restart when before/after change at runtime. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- "answers" -> "responds to" for the fallthrough: false behavior.
- Note the handler-ordering exception in the Auto-Updates section so it
no longer appears to conflict with the ordering docs.
- Clearer SPA example intro ("does not match an API route or a static
file") and "allows REST resources to be matched first".
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-562 This preview will update automatically when you push new commits. |
What
Documents the static plugin's
before/afterhandler-ordering options added in HarperFast/harper#1574, and fixes the SPA client-side routing example, which currently documents a config that breaks REST.Why
The static handler runs before authentication — and therefore before the REST handler — by default. The existing "SPA client-side routing" example (
notFound+fallthrough: false) therefore answers every unmatched GET with index.html, including GETs for exported REST resources: the application's API silently becomes unreachable over GET. This bit the create-harper SPA templates, fixed in HarperFast/create-harper#109.With harper#1574 in place, one line makes the recipe work as readers assume it does:
Changes to
reference/static-files/overview.mdfallthrough: falsetrap, theafter: 'rest'recipe with request mappings, and the new startup warning.beforeandafteradded to Additional Options (withv5.2.0badges), includingbefore: falseto clear the default constraint.after: 'rest', with a note about pre-5.2 behavior and a pointer to hash-based routing as the version-independent alternative (also keeps index.html cacheable at a single URL).after: 'rest'is needed.Verification
npm run format:checkclean;npm run buildsucceeds (the one broken-anchor warning is pre-existing inrelease-notes/v5-lincoln/5.1, unrelated to this page).after: 'rest', REST resources return JSON while unmatched deep links receive the index.html fallback.Related: HarperFast/harper#1574 - HarperFast/create-harper#109
🤖 Generated with Claude Code