| 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. Create a short link to https://duckduckgo.com using a query string
| $ curl {{.URL}}?https://duckduckgo.com
| {{.URL}}/1acd382417199d7e
|
| 4. Create a short link with a custom path using a query string
| $ curl {{.URL}}/ddg?https://duckduckgo.com
| {{.URL}}/ddg
|
| 5. You can also pass an encoded URL:
| $ curl {{.URL}}?https%3A%2F%2Fduckduckgo.com
| {{.URL}}/1dc4cb37e81de396
|
| 6. Deleting a short link
| $ TMP=$(mktemp)
| $ # the temp file will store the 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')
| $ # the deletion key is stored in the '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