🔗 Short URL API

📘 How to Use

This is a simple API to generate and access short URLs.

1️⃣ Create a Short URL

POST /

Body: JSON with a url field.

{
  "url": "https://example.com"
}

Example curl:

curl -X POST https://short.avshort.com/ \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'

2️⃣ Redirect to Original URL

GET /:code

Example: https://short.avshort.com/abc123 will redirect to your original URL.

3️⃣ View Demo Output

Visit / (this page) to view example rows from the database.


🗂 Recent Short Links (first 5 rows)

[
  {
    "id": 1,
    "code": "nai6oq",
    "long_url": "https://google.com",
    "created_at": "2025-04-23 12:12:41"
  },
  {
    "id": 2,
    "code": "9r0w2l",
    "long_url": "https://avshort.com/dashboard",
    "created_at": "2025-04-24 21:27:47"
  },
  {
    "id": 3,
    "code": "6dnr54",
    "long_url": "https://github.com/",
    "created_at": "2025-04-24 21:35:58"
  },
  {
    "id": 4,
    "code": "7cp7wd",
    "long_url": "https://webghost.bid",
    "created_at": "2025-04-24 21:37:29"
  },
  {
    "id": 5,
    "code": "bstjs0",
    "long_url": "https://avshort.com/contact",
    "created_at": "2025-04-24 21:46:17"
  }
]