| Examples:
|
| 1. Create a short link to https://duckduckgo.com
| $ curl -d https://duckduckgo.com {{.URL}}
| {{.URL}}/502fb5543c36014f
|
| 2. Create a short link with a custom path
| $ curl -d https://duckduckgo.com {{.URL}}/ddg
| {{.URL}}/ddg
|
| 3. Deleting a short link
| $ TMP=$(mktemp)
| $ # temp file will store header
| $ LINK=$(curl -sS {{.URL}} -d https://duckduckgo.com -D $TMP)
| $ # the link has been successfully created
| $ DEL=$(cat $TMP | grep -i delete-with | awk '{print$2}'| tr -d '\r')
| $ # deletion key is stored in 'X-Delete-With' header.
| $ curl $LINK
| <a href="https://duckduckgo.com">Permanent Redirect</a>.
| $ # the link is working as expected
| $ curl $LINK -X DELETE -d $DEL
| $ curl $LINK
| record not found
| $ # the link has been successfully deleted.
{{if .Demo}}
Please note: this is an example deployment. If you attempt to create a short link here you will receive a 401 Unauthorized. If you like the examples above and want to use this URL shortener you should self-host an instance. It's easy to do (one of the design goals). Below are instructions detailing how.
| How to self-host:
|
| 1. Install dependencies
| a. The Go programming language
| https://golang.org/doc/install
| b. Git version control
| https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
|
| * On FreeBSD this would be:
| $ pkg install -y go git
|
| 2. Fetch, complile, and execute the source code
| $ env GO111MODULE=off go get git.fsh.ee/i/link
| $ env GO111MODULE=off go run git.fsh.ee/i/link -url https://your.domain.com -port 8080 -db /path/to/sqlite/file -seed secret
|
| * The server is now running on localhost at port 8080.
| * If the SQLite database at this filepath does not exist it will be created.
| * All logging will be printed to standard error and standard output.
{{end}}