Skip to content

nogenhat/shorty

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shorty

Build Status

Tiny url shortener

Installation

You will need Go and Gom to build the project and PostgreSQL to make Shorty fly.

make
cp shorty.conf.sample shorty.conf

# First launch
RESET_DB=1 bin/shorty

# Futher launches
bin/shorty

Configuration

You can specify DB connection string by setting DB_CONN variable:

DB_CONN="dbname=my_db sslmode=disable" bin/shorty

You can specify server address by setting ADDRESS variable:

ADDRESS="192.168.1.1:4321" bin/shorty

API

POST /shorten (url=http://url_to_short.com/?lorem=ipsum)
# => http://domain.com/:code

GET /expand/:code
# => http://url_to_short.com/?lorem=ipsum

GET /:code
# => Redirect to http://url_to_short.com/?lorem=ipsum

GET /statistics/:code
# => Count of redirects to http://url_to_short.com/?lorem=ipsum

How to run tests

  1. First of all you need a public PostgreSQL DB named shorty_test.

  2. Next install testing packages with

gom -test install
  1. And finally run the following
gom test src/*

About

Tiny url shortener

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.0%
  • Makefile 1.0%