weirdvic / zetahedron

Simple URL shortener made with Go, Echo and Redis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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/

About

Simple URL shortener made with Go, Echo and Redis


Languages

Language:Go 93.8%Language:Dockerfile 4.6%Language:Makefile 1.6%