Crawls a given website (HTML), retrieves links in
<a>
tags, then recursively crawls found links too, and finally outputs all found URLs
Note: I limited it to finding 25 links, look for the const limit
symbol in index.ts
to change it.
- Learned fundamentals of unit testing with a Jest-like testing library (Vitest and Bun's test runner)
- Got a bit more familiar with the URL Class/API
With npm
# Install dependencies
npm i
# Run tests
npm test
# To run the app pass a website's URL as an argument
# Run app
npm start SITE_URL
# Run app on watch mode
npm run dev SITE_URL
# e.g. `npm start https://leonardo-gatti.pages.dev`
With bun
# Install dependencies
bun i
# Run tests
bun test
# To run the app pass a website's URL as an argument
# Run app
bun index.ts SITE_URL
# Run app on watch mode
bun --watch index.ts SITE_URL
# e.g. `bun index.ts https://leonardo-gatti.pages.dev`