go-short

command module
v0.0.0-...-adc5de2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2015 License: MIT Imports: 10 Imported by: 0

README

Go short!

Shorten url service written in GO.

API Endpoints

Create a short code [/api/v1/urls]

Shorten your input url.

curl -X POST -H "Content-Type: application/json" \
     -d '{"url": "http://yulun.me"}' \
     'http://localhost:3000/api/v1/urls'

	{
		"id":1,
		"url": "http://yulun.me",
		"code": "1pBnf",
		"hits": 0,
		"created_at": "2015-01-19T01:00:24+08:00"
	}
Query url by short code [/api/v1/urls/:code]

Get short code's information.

curl 'http://localhost:3000/api/v1/urls/1pBnf'

	{
		"id":1,
		"url":"http://yulun.me",
		"code":"1pBnf",
		"hits":1,
		"created_at":"2015-01-19T01:00:24+08:00"
	}
Redirect [/r/:code]

Redirect to url by assigned short code with status 301.

Short code chars: abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ

Demo

Demo site powered by Heroku

Deploy

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/julienschmidt/httprouter
Package httprouter is a trie based high performance HTTP request router.
Package httprouter is a trie based high performance HTTP request router.
_workspace/src/github.com/mattn/go-sqlite3
Package sqlite3 provides interface to SQLite3 databases.
Package sqlite3 provides interface to SQLite3 databases.

Jump to

Keyboard shortcuts

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