A template for generating a quick url shortener with a Cloudflare worker.
To generate using wrangler
wrangler generate ShortenerName https://github.com/gavdaly/shortener
Further documentation for Wrangler can be found here.
- Cope the destination below or copy the
wrangler.example.toml
towrangler.toml
- Create two
KV name spaces
, one for production and one for preview. - Copy the namespaces id and add it to the kv_namespaces
- Get your account id and zone id
- Copy them to the toml file
- run
wrangler publish
name = "cfshornener"
type = "javascript"
account_id = ""
workers_dev = true
route = "/"
zone_id = ""
kv_namespaces = [
{binding = "shortener", id = "", preview_id = ""}
]