https://github.com/stoppieboy/trimly
A URL shortening service using Golang, Go-Fiber, Redis and containerized with docker
https://github.com/stoppieboy/trimly
go-fiber golang redis
Last synced: 4 months ago
JSON representation
A URL shortening service using Golang, Go-Fiber, Redis and containerized with docker
- Host: GitHub
- URL: https://github.com/stoppieboy/trimly
- Owner: stoppieboy
- Created: 2025-01-28T14:13:48.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-01-29T19:49:13.000Z (8 months ago)
- Last Synced: 2025-03-24T08:49:48.846Z (7 months ago)
- Topics: go-fiber, golang, redis
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Trimly
A URL shortening service using Golang, Go-Fiber, Redis and containerized with docker
The API service Implements Rate limiting, Input Sanitization, and Custom Short URLs.
These shortened URLs are especially valuable on platforms with character limits, like Twitter, or in marketing campaigns where a clean, branded link is more appealing.
## API Documentation
### Shorten URL
**URL** : `/api/v1/`
**Method** : `POST`
**Data Params** :
| Name | Type | Description |
| --- | --- | --- |
| url | string | The URL to be shortened |
| short | string | The custom short URL |
| expiry | int | The expiry time in hours |**Success Status Code** : `201 Created`
**Success Response** :
```json
{
"url": "https://www.google.com",
"short": "https://trimly.com/abl3i4",
"expiry": 24,
"rate_limit": 10,
"rate_limit_reset": 30
}
```**Error Response** :
```json
{
"error": "Invalid URL"
}
```
```json
{
"error": "Domain error"
}
```
```json
{
"error": "Rate limit exceeded"
}
```### Resolve URL
**URL** : `/:url`
**Method** : `GET`
**Success Status Code** : `301 Moved Permanently`
**Success Response** :
```json
{
"url": "https://www.google.com"
}
```**Error Response** :
```json
{
"error": "short not found in the database"
}
```