Skip to content

docs: source homepage and Casbin examples from runnable files - #461

Merged
vishr merged 2 commits into
masterfrom
docs/source-homepage-casbin
Sep 30, 2026
Merged

vishr merged 2 commits into
masterfrom
docs/source-homepage-casbin

Conversation

@vishr

@vishr vishr commented Sep 30, 2026

Copy link
Copy Markdown
Member

The homepage code window maintained a hand-written JSON server while the runnable Hello World recipe returns plain text. Casbin middleware documentation repeated its wrapper in both an implementation excerpt and a full program across five locales.

  • Render the homepage from a named region in cookbook/hello-world/server.go, imported through Vite and highlighted with Astro's Code component. Share region extraction with Markdown includes and align the terminal response with the running recipe.
  • Include Casbin middleware, JWT setup, model and policy from the existing runnable files in all five locales. Link to the complete example instead of repeating its server and middleware. Existing headings/anchors and Basic Auth guidance remain available.
  • Add regression coverage for shared component/Markdown extraction and a single middleware definition per locale. Go changes only add documentation region markers.

Validation: all 37 Node tests; go vet ./...; go test -race ./...; complete stable/next production builds including API/translation/link/accessibility/performance checks; 767 routes and 56,576 internal links/assets; unchanged route and performance baselines; actionlint; git diff --check. Local browser checks cover desktop/mobile, light/dark, stable/next homepages, reduced motion, all five localized Casbin pages and sampled next pages. No page-wide horizontal overflow. The running Hello World recipe returns HTTP 200 with the displayed plain-text greeting. Existing Kapa requests return 404 on localhost; the external Ask AI service was not validated.

Addresses the homepage Hello World and Casbin drift items in Phase 3 of #456. Other Phase 3 work remains tracked there.

Comment thread site/src/components/HomeHero.astro Outdated
Comment thread site/src/content/docs/middleware/casbin-auth.md
- Include the enforcer setup from cookbook/casbin/server.go so the JWT and
  Basic Auth excerpts no longer reference an undefined `ce`; exit when the
  enforcer fails to load instead of continuing with a nil enforcer.
- List echo-jwt and golang-jwt in Dependencies for all locales.
- Strip Shiki's tabindex from the hero <pre>: the code window is aria-hidden,
  so a focusable child fails axe aria-hidden-focus.
@vishr
vishr merged commit 9d234d5 into master Sep 30, 2026
1 check 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.

1 participant