https://github.com/firmanmimang/shorten-url
URL shorten project API
https://github.com/firmanmimang/shorten-url
docker docker-compose golang redis
Last synced: 3 months ago
JSON representation
URL shorten project API
- Host: GitHub
- URL: https://github.com/firmanmimang/shorten-url
- Owner: firmanmimang
- Created: 2025-02-27T04:32:22.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-27T05:16:21.000Z (over 1 year ago)
- Last Synced: 2026-01-03T22:11:14.874Z (6 months ago)
- Topics: docker, docker-compose, golang, redis
- Language: Go
- Homepage: https://shorten-url-production.up.railway.app
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.MD
Awesome Lists containing this project
README
# Shorten URL API
## Overview
This API provides a URL shortening service. You can send a POST request with a long URL, and the API will return a shortened version of the URL.
## Endpoint
**Base URL:** `https://shorten-url-production.up.railway.app`
### **Shorten a URL**
- **Endpoint:** `/api/v1`
- **Method:** `POST`
- **Content-Type:** `application/json`
## Request Body
Send a JSON object containing the URL you want to shorten.
```json
{
"url": "https://sjpl.co.id"
}
```
## Response
If successful, the API will return a shortened URL.
### **Success Response (200 OK)**
```json
{
"short_url": "https://shorten-url-production.up.railway.app/abc123"
}
```
## Usage
You can test the API using `curl` or any API testing tool like Postman.
### **Using `curl` in Terminal**
```sh
curl -X POST "https://shorten-url-production.up.railway.app/api/v1" \
-H "Content-Type: application/json" \
-d '{"url": "https://sjpl.co.id"}'
```
### **Using an HTTP File**
If you're using VS Code with the REST Client extension, save the following as `shorten.http` and run it:
```http
POST https://shorten-url-production.up.railway.app/api/v1
Content-Type: application/json
{
"url": "https://sjpl.co.id" | "sjpl.co.id"
}
```
## Notes
- Ensure the provided URL is valid and properly formatted.
- The shortened URL will be returned in the response if successful.
- The API have rate limits.