Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clydedz/shorturl-cloudflare-workers
Demo Cloudflare Worker created for a Medium article.
https://github.com/clydedz/shorturl-cloudflare-workers
bitly bitly-alternative cloudflare cloudflare-kv cloudflare-worker cloudflare-workers demo demo-app kv-storage medium medium-article shorturl shorturl-services shorturls
Last synced: 17 days ago
JSON representation
Demo Cloudflare Worker created for a Medium article.
- Host: GitHub
- URL: https://github.com/clydedz/shorturl-cloudflare-workers
- Owner: ClydeDz
- License: mit
- Created: 2021-10-06T05:57:19.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-26T11:18:15.000Z (over 2 years ago)
- Last Synced: 2024-05-01T16:41:11.627Z (8 months ago)
- Topics: bitly, bitly-alternative, cloudflare, cloudflare-kv, cloudflare-worker, cloudflare-workers, demo, demo-app, kv-storage, medium, medium-article, shorturl, shorturl-services, shorturls
- Language: JavaScript
- Homepage: https://bit.ly/cdz858
- Size: 10.7 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Short URL service using Cloudflare Workers
Demo app created for a Medium article to demonstrate [Cloudflare Workers](https://workers.cloudflare.com/) and [Cloudflare KV storage](https://developers.cloudflare.com/workers/learning/how-kv-works). This app is a short URL service like bit.ly and the likes. We're also automatically deploying this Cloudflare Worker using GitHub Actions.
## Creating a short URL
Once you deploy both workers to your Cloudflare account, make a POST request to `https://createshorturl..workers.dev/` with a `application/json` body like below.```json
{
"uniqueKey": "git",
"website": "https://github.com"
}
```## Testing the redirect
Now, if you head over to `https://shorturl..workers.dev/git`, it will redirect you to https://github.com because the website that matches the `uniquekey` "git" supplied earlier and stored in the KV storage.See the About section of this repo for the link to the Medium article.
Follow me on Medium [@ClydeDz](https://clydedz.medium.com/).