go mod tidy
3. Run the application:
```bash
go run .
The server will start on port 8000 by default.
Visit http://localhost:8000 to access the web dashboard with the following services:
- Enter a long URL in the input field
- Click "Shorten URL"
- Copy and use the generated short URL
- Enter a website URL to monitor
- View real-time health metrics including:
- Response time
- Status code
- SSL certificate validity
- Uptime percentage
- Enter country code (e.g., +1)
- Enter phone number
- Get instant verification results
- Maximum file size: 10MB
- Supports any file type
- Steps:
- Select a file
- Enter a password
- Choose "Protect File" or "Unlock File"
- Download the processed file
POST /api/url/shorten
Content-Type: application/json
{
"url": "https://example.com/very/long/url"
}Response:
{
"short_url": "abc123"
}GET /api/url/stats/{shortCode}Response:
{
"short_code": "abc123",
"hit_count": 42,
"created_at": "2025-02-15T10:00:00Z",
"last_access": "2025-02-15T11:00:00Z"
}POST /api/health/add
Content-Type: application/json
{
"url": "https://example.com"
}Response:
{
"data": {
"id": "uuid-string",
"message": "Website added for monitoring"
}
}GET /api/health/status/{id}Response:
{
"data": {
"id": "uuid-string",
"url": "https://example.com",
"status": "up",
"response_time_ms": 150,
"status_code": 200,
"ssl_valid": true,
"uptime_percent": 99.9,
"check_history": [
{
"timestamp": "2025-02-15T10:00:00Z",
"status": "up",
"response_time_ms": 150,
"status_code": 200
}
]
}
}POST /api/mobile/verify
Content-Type: application/json
{
"country_code": "+1",
"phone_number": "2125551234"
}Response:
{
"data": {
"valid": true,
"phone_number": "2125551234",
"country_code": "+1"
}
}POST /api/encrypt
Content-Type: multipart/form-data
file: [binary file data]
password: your_passwordResponse: Protected file binary data with HTTP status 200
POST /api/decrypt
Content-Type: multipart/form-data
file: [protected file data]
password: your_passwordResponse: Original file binary data with HTTP status 200
Error Responses:
{
"error": "This file doesn't appear to be a protected file"
}{
"error": "Incorrect password or file is corrupted"
}All API endpoints return appropriate HTTP status codes:
- 200: Success
- 400: Bad Request
- 401: Unauthorized
- 404: Not Found
- 429: Too Many Requests
- 500: Internal Server Error
Error Response Format:
{
"error": "Error message description"
}