Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kashav/go-url-shortener
Shorten URLs with GitHub repositories and the http-equiv attribute.
https://github.com/kashav/go-url-shortener
golang http-equiv refresh url-shortener
Last synced: 6 days ago
JSON representation
Shorten URLs with GitHub repositories and the http-equiv attribute.
- Host: GitHub
- URL: https://github.com/kashav/go-url-shortener
- Owner: kashav
- License: mit
- Created: 2017-03-19T00:41:21.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-31T17:17:00.000Z (5 months ago)
- Last Synced: 2024-12-29T07:12:54.341Z (13 days ago)
- Topics: golang, http-equiv, refresh, url-shortener
- Language: Go
- Homepage:
- Size: 3.5 MB
- Stars: 150
- Watchers: 3
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - point - Create and manage shortened URLs with GitHub pages. (Go)
README
# go-url-shortener
A simple URL shortener that uses GitHub as a backend. This uses the [`http-equiv` refresh attribute](https://developer.mozilla.org/en/docs/Web/HTML/Element/meta#attr-http-equiv) to do URL redirection.
## Demo
[![asciicast](https://asciinema.org/a/132016.png)](https://asciinema.org/a/132016)
## Usage
You should export your personal GitHub access token as `GO_URL_SHORTENER_ACCESS_TOKEN`. Request one [here](https://github.com/settings/tokens) with the `repo` and `delete_repo` permissions.
Basic usage:
```sh
% git clone https://github.com/kashav/go-url-shortener && cd $_
% go build ./cmd/shortener/main.go
% ./main --help
usage: go-url-shortener [] [ ...]Create and manage shortened URLs with GitHub pages.
Flags:
--[no-]help Show context-sensitive help (also try --help-long and --help-man).
--[no-]verbose Show detailed output.Commands:
help [...]
Show help.create []
Create a new entry.list
Print a list of active entries.remove ...
Remove one or more entries.% ./main create --help
usage: go-url-shortener create []Create a new entry.
Flags:
--[no-]help Show context-sensitive help (also try --help-long and --help-man).
--[no-]verbose Show detailed output.
-c, --cname=CNAME Optional CNAME record for this repository.
-n, --name=NAME Endpoint for the shortened URL, chosen randomly if empty.
-p, --[no-]private Make this repository private.
-s, --[no-]subdir Use a subdirectory in a pre-existing repository, instead of creating a new
repository.
-r, --repo=REPO A pre-existing repository to be used with the --subdir option (expects `foo/bar`
for `https://github.com/foo/bar`). Pushes to the default branch.Args:
The URL to shorten.% ./main list --help
usage: go-url-shortener listPrint a list of active entries.
Flags:
--[no-]help Show context-sensitive help (also try --help-long and --help-man).
--[no-]verbose Show detailed output.% ./main remove --help
usage: go-url-shortener remove ...Remove one or more entries.
Flags:
--[no-]help Show context-sensitive help (also try --help-long and --help-man).
--[no-]verbose Show detailed output.Args:
List of entries to remove.
```