Skip to content

feat(gists): add GET /gists/:id/content endpoint#627

Merged
BigBen-7 merged 2 commits into
PinSpace-Org:mainfrom
RennyThompson:feat/606-gist-ipfs-content-endpoint
Jun 22, 2026
Merged

feat(gists): add GET /gists/:id/content endpoint#627
BigBen-7 merged 2 commits into
PinSpace-Org:mainfrom
RennyThompson:feat/606-gist-ipfs-content-endpoint

Conversation

@RennyThompson

Copy link
Copy Markdown
Contributor

Summary

Implements #606 — IPFS content retrieval endpoint.

Changes

  • IpfsService: getJson(cid) now reads the gateway URL from ipfs.gateway config (env: IPFS_GATEWAY, default: https://gateway.pinata.cloud/ipfs). Retries up to 3 times with 500ms backoff.
  • GistsService: getGistContent(id) fetches the gist, reads content_hash, calls IpfsService.getJson, caches the result in-memory for 5 minutes. Returns 404 if gist/CID missing, 502 if gateway fails.
  • GistsController: adds GET :id/content route (placed before GET :id to prevent route shadowing).
  • Config: IPFS_GATEWAY added to configuration.ts, env.validation.ts, and .env.example.

Tests

11 unit tests pass (4 create, 2 findOne, 5 getGistContent: success, cache hit, 404 not found, 404 no CID, 502 IPFS failure).

Closes #606

…#606)

- Add IpfsService.getJson with configurable gateway (IPFS_GATEWAY env var) and 3-attempt 500ms backoff retry
- Add GistsService.getGistContent with 5-min in-memory cache; 404 for missing gist/CID, 502 on IPFS failure
- Add GET :id/content route to GistsController (before :id to prevent route shadowing)
- Add IPFS_GATEWAY to configuration.ts, env.validation.ts, and .env.example
- Add unit tests: success, cache hit, 404 not found, 404 no CID, 502 IPFS failure
@BigBen-7 BigBen-7 merged commit d2a4292 into PinSpace-Org:main Jun 22, 2026
1 check failed
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.

Add IPFS content retrieval endpoint — GET /gists/:id/content

2 participants