Skip to content

buraksh/link-shortener

Repository files navigation

Link Shortener Service

Very simple link shortener service written in Go (Golang).

How to run

  1. Create .env file and
cp .env.example .env
  1. Run container
docker-compose up -d

Endpoints

Ping server

GET /ping

Response

HTTP 200 OK

{
  "message": "pong"
}

Create short URL

POST /links

Parameters

Name Required Type Description
url Yes string URL to shorten.
Must be a valid UR.L
single_use No integer Whether the short url can be used only once or not.
0: multiple use (default)
1: single use

Response

HTTP 200 OK

{
  "key": "1e1df7dd",
  "url": "http://google.com"
}

Redirect to URL

GET /:key

Response

HTTP 301 Moved Permanently

License

This project is open-sourced software licensed under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published