Cloudflare Worker that redirects ISBN numbers to their corresponding book pages on The StoryGraph.
Simple API endpoint that takes ISBN numbers as input and redirects users to the respective book page on The StoryGraph. Built as a serverless function for fast, global distribution.
- ISBN to book page redirection
- Serverless deployment via Cloudflare Workers
- Fast global edge network
- Lightweight and minimal dependencies
- Accepts ISBN as path parameter (
/redirect/{isbn}) - Queries The StoryGraph for the book
- Extracts the book page URL
- Issues HTTP redirect to the target page
Make a GET request to the worker endpoint:
https://your-worker.your-subdomain.workers.dev/redirect/{isbn}
Example:
https://your-worker.your-subdomain.workers.dev/redirect/9780226526812
- Cloudflare Workers
- TypeScript
- Hono framework
- node-html-parser for HTML parsing
- Zod for validation
- Wrangler CLI for deployment
Install dependencies and run locally:
npm install
npm run devDeploy to Cloudflare:
npm run deployMIT Copyright (c) Luca Pette