diff --git a/packages/http/src/index.ts b/packages/http/src/index.ts index c1ad0102..7fa44e3b 100644 --- a/packages/http/src/index.ts +++ b/packages/http/src/index.ts @@ -3,6 +3,8 @@ * * Exports a `createHeliaHTTP` function that returns an object that implements a lightweight version of the {@link Helia} API that functions only over HTTP. * + * By default, content and peer routing are requests are resolved using the [Delegated HTTP Routing API](https://specs.ipfs.tech/routing/http-routing-v1/) and blocks are fetched from [Trustless Gateways](https://specs.ipfs.tech/http-gateways/trustless-gateway/). + * * Pass it to other modules like {@link https://www.npmjs.com/package/@helia/unixfs | @helia/unixfs} to fetch files from the distributed web. * * @example @@ -17,6 +19,28 @@ * const fs = unixfs(helia) * fs.cat(CID.parse('bafyFoo')) * ``` + * @example with custom gateways and delegated routing endpoints + * ```typescript + * import { createHeliaHTTP } from '@helia/http' + * import { trustlessGateway } from '@helia/block-brokers' + * import { delegatedHTTPRouting } from '@helia/routers' + * import { unixfs } from '@helia/unixfs' + * import { CID } from 'multiformats/cid' + * + * const helia = await createHeliaHTTP({ + * blockBrokers: [ + * trustlessGateway({ + * gateways: ['https://cloudflare-ipfs.com', 'https://ipfs.io'], + * }), + * ], + * routers: [ + * delegatedHTTPRouting('https://delegated-ipfs.dev') + * ] + * }) + * + * const fs = unixfs(helia) + * fs.cat(CID.parse('bafyFoo')) + * ``` */ import { trustlessGateway } from '@helia/block-brokers' diff --git a/packages/routers/src/index.ts b/packages/routers/src/index.ts index 98c581bf..c82e8cbd 100644 --- a/packages/routers/src/index.ts +++ b/packages/routers/src/index.ts @@ -1,2 +1,7 @@ +/** + * @packageDocumentation + * + * Abstraction layer over different content and peer routing mechanisms. + */ export { delegatedHTTPRouting } from './delegated-http-routing.js' export { libp2pRouting } from './libp2p-routing.js'