https://github.com/skb08/url-short
Go-based URL shortener with support for YAML, JSON, and database-driven path mappings.
https://github.com/skb08/url-short
golang json yaml
Last synced: about 2 months ago
JSON representation
Go-based URL shortener with support for YAML, JSON, and database-driven path mappings.
- Host: GitHub
- URL: https://github.com/skb08/url-short
- Owner: Skb08
- Created: 2025-01-11T15:16:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-11T15:23:30.000Z (over 1 year ago)
- Last Synced: 2025-03-02T17:12:31.405Z (over 1 year ago)
- Topics: golang, json, yaml
- Language: Go
- Homepage:
- Size: 4.55 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# URL Shortener 🌐🔗
A simple and user-friendly URL shortener written in Go, supporting flexible URL redirection via YAML, JSON, and database-driven path mappings.
---
## Features ✨
- **Default MapHandler**: Basic in-memory URL mapping.
- **YAMLHandler**: Load URL mappings from a YAML file.
- **JSONHandler**: Load URL mappings from a JSON file.
- **DatabaseHandler**: Extendable to use a database (like BoltDB or SQL) for URL mappings.
---
## How to Run 🚀
### Prerequisites
- Go installed on your system. If you don't have it yet, [Download Go](https://golang.org/dl/).
### Steps
1. **Clone the repository**:
```bash
git clone https://github.com//urlshort.git
cd urlshort
```
2. **Build the project**:
```bash
go build
```
3. **Run the application with the desired configuration**:
- **Default MapHandler**:
```bash
./urlshort
```
- **YAMLHandler**:
```bash
./urlshort -yaml urls.yaml
```
- **JSONHandler**:
```bash
./urlshort -json urls.json
```
---
## Example Configuration Files 📄
### Example YAML File (`urls.yaml`)
```yaml
- path: /example
url: https://example.com
- path: /github
url: https://github.com