go-url-shortener

module
v0.0.0-...-32af5a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2024 License: MIT

README

go-url-shortener


Software Architecture

image


API list

1. /api/ping

Request Method: GET

Response:

{
    "status": "up and running"
}
2. /api/shorten

Request Method: POST

Request Body:

{
  "url": "https://www.youtube.com/watch?v=TLB5MY9BBa4&ab_channel=CoderDave"
}

Response:

{
    "results": {
        "id": 13,
        "actual_url": "https://www.youtube.com/watch?v=TLB5MY9BBa4&ab_channel=CoderDave",
        "short_url": "77cf66ac",
        "total_hit": 0,
        "created_at": "2023-07-23T14:37:53.241159Z"
    }
}
3. /api/decode/{shortUrl}

Request Method: GET Response:

{
    "results": {
        "id": 13,
        "actual_url": "https://www.youtube.com/watch?v=TLB5MY9BBa4&ab_channel=CoderDave",
        "short_url": "77cf66ac",
        "total_hit": 6,
        "created_at": "2023-07-23T14:37:53.241159Z"
    }
}
4. /api/urls?limit=10&offset=10

Request Method: GET Query Parameter:

limit = <<number>> // 10
offset = <<number>> // 1

Response:

{
    "count": 15,
    "results": [
        {
            "id": 14,
            "actual_url": "https://www.example.com/",
            "short_url": "8797b6c7",
            "total_hit": 0,
            "created_at": "2023-07-23T17:16:09.239242Z"
        }
    ]
}

Directories

Path Synopsis
cmd
api
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL