feat: add /docs/api page with interactive Swagger UI - #200
Closed
SpikeyCoder wants to merge 2 commits into
Closed
Conversation
Adds an interactive API documentation page at /docs/api that renders
the FunderMatch OpenAPI spec using Swagger UI loaded from the unpkg CDN.
- New page: src/pages/ApiDocsPage.tsx
- Loads Swagger UI via a sandboxed blob-URL iframe (avoids bundling
the 1.5 MB swagger-ui-react dependency)
- Includes intro header, "Get an API Key" CTA, and raw spec link
- Public route — no authentication required
- Route: added lazy-loaded /docs/api route in App.tsx
- CSP: added frame-src blob: directive in index.html
- Footer: added "API Docs" link
Deploying funder-finder with
|
| Latest commit: |
a2b782b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://42745445.funder-finder.pages.dev |
| Branch Preview URL: | https://feat-api-docs-page.funder-finder.pages.dev |
Owner
Author
|
Merged into PR #199 per owner request. Closing this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a public
/docs/apipage that renders the FunderMatch OpenAPI spec as interactive Swagger UI documentation.How it works
ApiDocsPage.tsxconstructs a self-contained HTML document that loads Swagger UI from the unpkg CDN and points it at the OpenAPI spec at:This HTML is rendered inside a sandboxed blob-URL iframe, which means:
swagger-ui-reactdependency (would add ~1.5 MB to the JS bundle). The ApiDocsPage chunk is only 3.3 KB.Files changed
src/pages/ApiDocsPage.tsxsrc/App.tsx/docs/apiroute (public, no AuthGuard)index.htmlframe-src blob:to CSP for the iframesrc/components/Footer.tsxPage features
Build verification
tsc -b— passes cleanlyvite build— passes cleanly, ApiDocsPage chunk is 3.3 KBCSP note
Added
frame-src blob:to allow the blob-URL iframe. This is a minimal, safe CSP addition — blob URLs can only be created by same-origin scripts (our own bundled code), so no external content can inject frames.