Skip to content

Search the guides, deployment pages, and API reference.

crawl

import { crawl } from "@pitlane/crawler";
function crawl(router, options?): AsyncIterableIterator<CrawlResult>;

Walks an app by dispatching requests straight into its router, yielding each response as it arrives. No socket, no server, no browser: the router's fetch is the whole transport, so this runs anywhere the app itself runs.

Yields in completion order. Every path is fetched at most once. A redirect yields nothing and reports through CrawlOptions.onRedirect; any other non-2xx response aborts the crawl.

Parameters

router

CrawlTarget

The router to crawl.

options?

CrawlOptions = {}

Crawl options.

Returns

AsyncIterableIterator<CrawlResult>

An async iterator of results, one per fetched path.

See