High-Performance Shortlink ( Short URL ) app creator in Golang. For privacy reasons, you may prefer to host your own short URL app and this is the one to use.
APACHE-2.0 License
Shortlink App in Golang
JWT
or paseto
. Self Implement.Please see the architecture
file in the repository on option you can use the app. For some minor tweaking may be required.
List of Library and Framework used in building the app:
Just download and run go run main.go
and you are ready to go.
To deploy to server, prefer DigitalOcean
Common Steps to Launch:
go mod tidy
go mod vendor
go run main.go OR go build -ldflags "-s -w" main.go && ./main
constant.go
:Production = 2 // Please set to 1 if in production.
Domain = "https://lin.ks/"
CookieName = "lin.ks"
NodeID = "N1|" // Increase per node by value as "N2|", "N3|"... for multiple node
DBFolder = "/home/ubuntu/go/src/shortlink/db/"
AddFromToken = 3 // firt N character to get from token and use it in ShortID
ShortIDToken = 7 // Further added from 1st N char of AddFromToken+NodeID: total=12
APITokenLength = 32
/:short_code_here
- /api/create [Post]
Takes `{"url": "https://github.com"}` with `Authorization: Bearer {token}` from Header
- /api/update [Post]
Takes `{"old": "https://github.com", "new": "https://bitbucket.com", "short": "shortcode"}` with `Authorization: Bearer {token}` from Header
- /api/delete [Post]
Takes `{ "long": "https://bitbucket.com", "short": "shortcode"}` with `Authorization: Bearer {token}` from Header
- /api/fetch [GET]
Takes `Authorization: Bearer {token}` from Header
- /api/fetch/:short_code_here [GET]
{short_code_here} in the URL and Takes `Authorization: Bearer {token}` from Header
Note: Remember to implement Auth
system of your own and Replace APITokenLength
check with your own function.
Please see the rest.http
file to understand the request type in live details.
Share your feature request via issue
tracker.
1Hp24RtL3o86boapSAD3DtyqF5jdq1rfpM
Distributed under the Apache License 2.0. See LICENSE
for more information.