An open API service indexing awesome lists of open source software.

https://github.com/serverwentdown/short

A tiny, two-dependency, unauthenticated URL shortener service
https://github.com/serverwentdown/short

golang golang-application url-shortener

Last synced: 12 months ago
JSON representation

A tiny, two-dependency, unauthenticated URL shortener service

Awesome Lists containing this project

README

          

# short

A tiny, two-dependency, unauthenticated URL shortener service.

# Getting started

Start a cockroachdb server:

```
cockroach start --insecure
echo "CREATE DATABASE IF NOT EXISTS short;" | cockroach sql --insecure
```

Build and run short:

```
go build
./short -postgres postgresql://root@localhost:26257/short?sslmode=disable
```

# Usage

```
$ short -h
Usage of ./short:
-baseurl string
baseurl URL of short links (default "localhost:port")
-num int
number of characters in shortened url (default 4)
-port int
listen on port (default 8080)
-postgres string
postgres string (default "postgresql://root@localhost:26257/short?sslmode=disable")
```

See [pq docs](https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters) for more information on the postgres string.