feat(gists): add GET /gists/:id/content endpoint#627
Merged
BigBen-7 merged 2 commits intoJun 22, 2026
Merged
Conversation
…#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
6 tasks
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.
Summary
Implements #606 — IPFS content retrieval endpoint.
Changes
getJson(cid)now reads the gateway URL fromipfs.gatewayconfig (env:IPFS_GATEWAY, default:https://gateway.pinata.cloud/ipfs). Retries up to 3 times with 500ms backoff.getGistContent(id)fetches the gist, readscontent_hash, callsIpfsService.getJson, caches the result in-memory for 5 minutes. Returns 404 if gist/CID missing, 502 if gateway fails.GET :id/contentroute (placed beforeGET :idto prevent route shadowing).IPFS_GATEWAYadded toconfiguration.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