shawty

command module
v0.0.0-...-280c745 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2016 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

GoDoc license

Shawty: URL Shortener

This service encodes URLs using Hashids

It has 3 features:

Encode
curl -XPOST localhost:8080/encode --data "url=http://dillbuck.com"

>>> pnel5aK

NOTE: url must include the full url, http://etc...

Decode
curl localhost:8080/decode/pnel5aK

>>> http://dillbuck.com

Redirect
curl localhost:8080/pnel5aK

>>>  301 -> http://dillbuck.com

Getting started

Docker

docker run -v <host path>:/data -e "SHAWTY_STORAGE_PATH=/data" -e "SHAWTY_HASH_SALT=<salt>" -d -p 8080:8080 gimanzo/shawty

Old School way:

go get github.com/gimanzo/shawty

export SHAWTY_STORAGE_PATH=<your local storage path>
export SHAWTY_SALT=<your salt>
//optional
export GOOGLE_TRACKER_ID=<your google analytics trackingid>

go build
./shawty
Building the docker file
docker build -t gimanzo/shawty .
Can I use it in production?

You need to implement a storage that can scale beyond one application server.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package storages allows multiple implementation on how to store short URLs.
Package storages allows multiple implementation on how to store short URLs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址