You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Max Schmitt a332b2845e Improved README.md 8 years ago
.vscode Initial commit 8 years ago
handlers Added package synonyms 8 years ago
store Extend Standard installation 8 years ago
.gitignore Initial commit 8 years ago
.travis.yml fixed coveralls 8 years ago
LICENSE.md - Added LICENSE.md 8 years ago
README.md Improved README.md 8 years ago
docker-compose.yml fixed naming to URL Shortener 8 years ago
main.go fixed naming to URL Shortener 8 years ago
run.sh Initial commit 8 years ago

README.md

Golang URL Shortener

Build Status GoDoc Go Report Card Coverage Status License

Main Features:

  • URL Shortening
  • Visitor Counting
  • Deletion URLs
  • Authorization System
  • High Performance database with bolt
  • ShareX integration
  • Easy Docker Deployment

Server Installation

Standard

Since we don't provide prebuild binaries, you have to build it yourself. For that you need golang and git installed on your system.

git clone https://github.com/maxibanki/golang-url-shortener # Clone repository
cd golang-url-shortener # Go into it
go get -v ./... # Fetch dependencies
go build # Build executable
./golang-url-shortener # Run it

Docker Compose

Envirment Variables:

Envirment Variable Description Default Value
SHORTENER_DB_PATH Relative or absolute path to the bolt DB main.db
SHORTENER_LISTEN_ADDR Adress to which the http server should listen to :8080
SHORTENER_ID_LENGTH Length of the random short URL id 4

Clients:

ShareX Configuration

This URL Shortener has fully support with ShareX. To use it, just import the configuration to your ShareX. For that you need to open the Destination settings => Other / Custom uploaders => Import => From Clipboard.

After you've done this, you need to set it as your standard URL Shortener. For that go back into your main menu => Destinations => URL Shortener => Custom URL Shortener.

{
  "Name": "Golang URL Shortener",
  "DestinationType": "URLShortener",
  "RequestType": "POST",
  "RequestURL": "http://127.0.0.1:8080/api/v1/create",
  "Arguments": {
    "URL": "$input$"
  },
  "ResponseType": "Text",
  "URL": "$json:URL$"
}

Curl

HTTP Endpoints:

/api/v1/create POST

Create is the handler for creatng entries, you need to provide only an URL. The responsive will always be JSON encoded and contain an URL with the short link.

There is a mechamism integrated, that you can call this endpoint with the following techniques:

  • application/json
  • application/x-www-form-urlencoded
  • multipart/form-data

In all cases only add the long URL as a field with the key URL and you will get the response with the short URL.

/api/v1/info POST

This handler returns the information about an entry. This includes:

  • Created At
  • Last Visit
  • Visit count

To use this, POST a JSON with the field id to the endpoint. It will return a JSON with the data.

TODO

  • Authentification
  • Deletion
  • Add Curl Examples
  • Test docker-compose installation
  • Spell checker