Ambrose Chua 5b8692a930 | ||
---|---|---|
vendor | ||
.gitignore | ||
Dockerfile | ||
LICENSE | ||
README.md | ||
assets.go | ||
generate.go | ||
go.mod | ||
go.sum | ||
handlers.go | ||
healthz.go | ||
main.go | ||
router.go | ||
store.go |
README.md
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 for more information on the postgres string.