Skip to content

bfdes/url-shortener

Repository files navigation

url-shortener

GitHub Actions Codecov

URL shortener and redirect service designed for low-latency, read-heavy use.

Usage

Requirements

Run the following command within the repository root to start container dependencies in the background:

docker compose up --detach cache database

Then, when the databases are ready to accept connections, start the server with go run ..

Shorten a URL

curl http://localhost:8080/api/links \
  --request POST \
  --data '{"url": "http://example.com"}'
# {"url": "http://example.com", "slug": "<SLUG>" }

Redirect a URL

curl http://localhost:8080/<SLUG>

Testing

Run unit and integration tests with go test after starting container dependencies.

GitHub Actions will run tests for every code push.

Deployment

This URL shortener is unsuited for production use; it does not support logging or metric collection.

About

URL shortener and redirect service.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published