https://github.com/kzu/aka
An Azure function implementing a URL shortening service backed by Azure blob storage
https://github.com/kzu/aka
Last synced: 9 months ago
JSON representation
An Azure function implementing a URL shortening service backed by Azure blob storage
- Host: GitHub
- URL: https://github.com/kzu/aka
- Owner: kzu
- License: mit
- Created: 2021-01-11T10:38:58.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-09-12T15:49:40.000Z (almost 3 years ago)
- Last Synced: 2025-03-17T18:56:14.015Z (over 1 year ago)
- Language: C#
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# Azure serverless URL shortening service
An Azure function implementing a URL shortening service backed by Azure blob storage
in the fewest lines of code possible (~70 LoC).
[Read the announcement](https://www.cazzulino.com/minimalist-shortlinks.html)
## Installing
1. Fork the repo
2. Create an Azure Functions app for it
3. Add an `X-Authorization` setting containing a shared key used for creating the short links
4. Add automated deployment from the repo
The short URLs will be persisted in the same Azure storage account used by the app, in a table
named `Aka`.
## Usage
The function provides a REST API for URL shortening, as well as the resolving itself.
All mutating operations (POST, PUT, DELETE) require the client providing an `X-Authorization`
value that needs to match the setting configured server-side (that is, a shared key/secret).
Usage is trivial: just `POST` or `PUT` to the desired short URL you want, passing the target
URL in the body, like so:
```
# create or update shortlink
curl -d [TARGET_URL] -H "X-Authorization: [SHARED_SECRET]" https://[FUNCTION_APP_URL]/[SHORT_ALIAS]
```
The `X-Authorization` must match what you specified in step 3 during install/configuration.
That's it.
Example redirection [stats](https://github.com/kzu/aka/blob/main/stats/run.csx) badge:
