GShortify, a URL Shortener application built to demonstrate intermediate CRUD operations that can be performed using Golang. It involves the creation and consumption of APIs, allowing to shorten and manage URLs efficiently, while showcasing key concepts such as data handling, routing, and database interaction.
- HTML/CSS/Javascript (Frontend)
- Go (Backend)
- Supabase (Database)
👉 API Creation: using gorilla/mux package to serve different endpoints for URL shortener
👉 API consumption: by the UI application to shorten a long URL
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/routes/redirect/:shortid |
Redirect to original URL |
| GET | /api/v1/routes/urls |
List all URLs and corresponding shorten id |
| POST | /api/v1/routes/shorten |
Create shorten id and shorten URL |
| PUT | /api/v1/routes/update/:shortid |
Update original URL |
| DELETE | /api/v1/routes/update/:shortid |
Update original URL and corresponding shorten id |
List original URL and corresponding shortID
Request
- Client's IP Address
Response
{
"code": 200,
"message": "Data found",
"data": [
{
"tw9apb98": "https://google.com"
},
{
"ngMI98wQ": "https://yahoo.com"
},
{
"O8dYvXGH": "https://netflix.com"
},
{
"d9jYcHDU": "https://zee5.com"
}
]
}Shorten long URL
Request
{
"url": "https://linkedin.com"
}Response
{
"code": 201,
"message": "Shorten url generated successfully",
"data": {
"shortened-url": [
{
"localhost:8080/z5VAZ6bN"
}
]
}
}Update original URL
Request
{
"url": "https://google.co.in"
}Response
{
"code": 200,
"message": "Data updated successfully",
"data": [
{
"previous-url": "https://google.com",
"original-url": "https://google.co.in",
"short-id": "tw9apb98"
}
]
}