Categorygithub.com/weirdvic/zetahedron
repository
0.0.0-20241217063505-6b393c379a10
Repository: https://github.com/weirdvic/zetahedron.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Zetahedron

Simple URL shortener made with Go, Echo and Redis

Go Redis Docker

Build and run

Using Docker Compose

# Clone the repository
git clone https://github.com/weirdvic/zetahedron.git

# Run the app
docker compose up --build --detach

By default the app will be listening on http://localhost:1323

API description

/shorten

Try to shorten an URL.

Request params:

url — an URL to shorten

url_slug — optional short URL slug

expiry — optional short link expiration time in hours Example request:

curl -s -X POST -H 'Content-Type: application/json' \
-d '{"url":"https://thebestmotherfucking.website/"}' \
http://localhost:1323/shorten

Example output:

{
  "url": "https://thebestmotherfucking.website/",
  "short_url": "http://localhost:1323/mpdN0iJlZ0h",
  "expiry": 24
}

/:url

Try to resolve short URL slug to the original URL

Request params: none, short URL provided in request path

Example request:

curl -Ls -w %{url_effective} -o /dev/null http://localhost:1323/mpdN0iJlZ0h

Example response:

https://thebestmotherfucking.website/