An implementation of https://github.com/kellegous/go. An internal focused URL shortener.
go get github.com/clintjedwards/goto
To enable functionality such as go/mylink
, you'll need two pieces of functionality.
- The application must be given an A record: Ex.
go.clintjedwards.home
- Through DHCP you must set up search domains that include the (example)
clintjedwards.home
domain - Now simply typing
go/{something here}
will take you to your shortened link
Route | Methods | Payload | Returns |
---|---|---|---|
/links | GET | None | [{url, id, hits, created}] |
/links/{id} | GET, DELETE | None | {url, id, hits, created}, nil |
/create | POST | {url, id} | {url, id, hits, created} |
/{id} | GET | None | 302/Redirect |
Examples use httpie
// Normal links work just how you expect
http POST localhost:8080/create url="https://github.com" id="github" // normal link
http GET localhost:8080/github // Use ID to redirect to full URL
http GET localhost:8080/github?tab=repositories // query params are passed to the full URL
// Formatted links allow you to substitute variables that might be in the middle of a link
http POST localhost:8080/create url="https://github.com/clintjedwards/{}/issues" id="github"
http GET localhost:8080/github/release // Returns a link to: https://github.com/clintjedwards/release/issues
http GET localhost:8080/links // View all links
http GET localhost:8080/links/test // View specific link details
http DELETE localhost:8080/links/test // Remove a link
The following short names are reserved for app use: ["links", "create", "version", "status", "health", "edit", "api"]
- Clint Edwards - Github