Build a URL Shortener with Cloudflare Workers & KV
Source code GitHub: https://github.com/crazypeace/Url-Shorten-Worker Setup tutorial: https://zelikk.blogspot.com/2022/07/url-shorten-worker-hide-tutorial.html In localStorage, only write the random string of the short URL Omitted No need to use wrapping for displaying the urlList. Change to wrapping Omitted When displaying the short URL, add a delete button in front First turn off auto-loading localStorage, then try writing it in the HTML to see the effect. X some text X some text some text some text some text some text some text some text some text some text some text some text API supports deleting short URLs POST adds fields cmd: value add, del; keyPhrase: when adding, it's a custom short URL; when deleting, it's the short URL specified for deletion. For the part displaying the urlList, add an onclick event inside the button onclick='deleteShortUrl("4rEbzm")' >X some text onclick='deleteShortUrl("8NKY34...